Updated to take a string as a filename and creates its own file instance instead of using an already opened file instance.

There were issues with moving file pointers so this way fixes that.