When you shelve the changes, there is a checkbox towards the bottom “Preserve pending changes locally”. Uncheck that and it will undo the checkouts on the files as it builds the Shelf.
Also, once a shelf is created you can safely undo the checkouts yourself; Same result but I consider the checkbox a little safer in that it only undoes the checkout on files that you are shelving (so you won’t accidentally undo the checkout of a file that you missed or intentionally didn’t shelve).