Use signal handler instead of shutdownhook

Seeing problems with shutdown hook. Instead using signal handler.