added a shutdown hook to the process