Add graceful shutdown code to server.js.