Exit gracefully on SIGTERM/SIGINT