Stop writing when the source stream is finished