There may come a time when you find it necessary to euthanize your hermit crab to end it’s suffering. I’m providing the information that I found to be reliable.
Please ensure that you are not confusing a surface molt with death.
https://www.researchgate.net/post/What_is_the_least_drastic_method_to_kill_decapod_crustaceans_for_subsequent_preservation
http://kb.rspca.org.au/What-is-the-most-humane-way-to-kill-crustaceans-for-human-consumption_625.html