end stream on error

this does two things

1. end the stream after an error is emitted in onHead
2. wait until onHead has run before emitting head