end stream on error