Fix spurious exception at end of input.

When triggering end a second time, some structures have sometimes already
been cleaned up, leading to exceptions. Furthermore there is no need to
effectively end the stream twice.

The full exception was:
  _stream_readable.js:594
        state.pipes.forEach(write);
                    ^
  TypeError: Cannot call method 'forEach' of null
      at flow (_stream_readable.js:594:19)
      at Socket.<anonymous> (_stream_readable.js:573:7)
      at Socket.EventEmitter.emit (events.js:92:17)
      at onwriteDrain (_stream_writable.js:283:12)
      at afterWrite (_stream_writable.js:271:5)
      at onwrite (_stream_writable.js:264:7)
      at Socket.WritableState.onwrite (_stream_writable.js:97:5)
      at Object.afterWrite (net.js:728:12)
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.
Merge pull request #1 from roadrunner2/master

Improve handling of error conditions