Correct closing stream