Stops the server.
All asynchronous activities performed by the server will be stopped before this function returns.