end the stream when the context ends