Exit stream on unexpected EOF