tcpsocket: add close() method.
main: close the tcp socket when connection broken.