Bug Fix

1. in `main.cpp` and `chess.py`: fix bug for invalid message
2. in `network.cpp`: close socket when server is exiting