diff --git a/src/Renci.SshNet/SshCommand.cs b/src/Renci.SshNet/SshCommand.cs index 37e91da08..d8b2e69cd 100644 --- a/src/Renci.SshNet/SshCommand.cs +++ b/src/Renci.SshNet/SshCommand.cs @@ -398,13 +398,15 @@ private void Channel_Closed(object sender, ChannelEventArgs e) var outputStream = OutputStream; if (outputStream != null) { - outputStream.Flush(); + outputStream.Dispose(); + OutputStream = null; } var extendedOutputStream = ExtendedOutputStream; if (extendedOutputStream != null) { - extendedOutputStream.Flush(); + extendedOutputStream.Dispose(); + ExtendedOutputStream = null; } _asyncResult.IsCompleted = true;