fixed unclosed InputStream bug