Added code to handle termination of watchdog while shutting down the server.