Added a shutdown hook