Solve cyclic dependency for implicit close of socket on GC free.

Sockets are now closed when they are garbage collected.