Error: Cannot invoke "java.io.InputStream.close()" because "istream" is null