closing streams fix