More idiomatic way of terminating the server.