patch to make .end(data) work

stream.end(data) didn't work, which was surprising. This patch makes .end() work more like core streams.