Listen to SIGTERM and shutdown gracefully