Add a shutdown handler for clean shutdown.
Add a shutdown handler for clean shutdown.