Handle graceful shutdown of web server.