fixed unclosed streams