Update to end the stream when emitting an error