#23 - Implement graceful shutdown.