Close socket.
Merge pull request #1262 from jimis/socket_descriptor_leak

Close socket.