Close the channel on error.
Add reader.end.

Also, re-throw any existing error if an error occurred and a subsequent
operation was requested.