fix crash: call socket.destroy() not socket.close() on error