Graceful shutdown implemented.