[server.py] fix #8 server crash on close