Wait for the server to shutdown