Adds shut down listener for graceful shutdowns