correctly setting shutdownhook