Don't let writable streams transition from errored to closed.

The previous logic would transition to closed upon fulfillment of the promise returned from the underlying sink's close(), even if in the meantime the stream had become errored.