Fix InputStream not closed when you open a file to this function

If you Use ImageFactory.read(file), it will open a stream and won't close it, so here I add a new Method that you can pass your stream to read file and close it by yourself, or you can use this new read method, as it will close the stream while it finished it's word