Cleanly shutdown when given SIGINT, SIGHUP or SIGTERM.