Fix sporadic output truncation.

Calling end() will not flush any pending data in the stream. Hence the
output stream was sometimes being truncated. The proper and documented
way to signal the end of data for a readable stream is to push a null.
Avoid killing the nodejs process on stream and child errors.

If an object does not have a handler for the 'error' event, then when
such an event is sent the nodejs process will generally terminate. This
therefore installs a handler on both internal streams and the child
process which forwards the event to the returned stream; it's up to the
caller to install an appropriate handler for that.