stream: check _events before _events.error

This fixes the regression introduced by 5458079, which breaks the
net/net-pipe benchmark script.

Closes #6145