handle closing the server