demuxStream: properly end output streams

Call the `end` method on the `stdout` and `stderr` stream when the source stream is out of data.