Correctly respond to kill -15 and kill -2 and shut down gracefully (also in GUI mode)