Close the server properly.