Drop socket reference on close.

Closes #1976
- Prevent the unbounded memory growth caused by maintaining
  a reference to the socket object that is created on every connection.
Merge pull request #4430 from jaswilli/leak

Drop socket reference on close.