Close the socket if the class destructs

Close the socket if the class destructs and the private _socket property contains a resource.