lib: fix unhandled errors in webstream adapters
WebStream's Readable controller does not tolerate .close()
being called after an error
. However, when wrapping a Node's Readable stream it is possible that the sequence of events leads to finished()
's callback being invoked after such error
.
In order to handle this, in this change we call the finished()
handler earlier when controller is canceled, and always handle this as an error case.