Removed bug closing the socket in Message.toStream and fromStream