fix #998 to close the stream when deadlock

In the past we did cancel the async stdout/err operations and wait for it to complete (canceled).   However, this still deadlock.   This fix simply close/dispose the stdout/err.  This should force the stream to abort all operations.