Gracefully cleanup when termination signals are sent to your process.