Why close the socket on each write?