Tcp output client remote-has-closed fix