Finalizer improvements

Don't finalize context if it's already terminated explicitly.

Add a finalizer that closes socket.
This way bound sockets will not linger forever and leak resources.