Adding shutdown hook