Added a safe call to Server.on_close when Server.close is called.