Fixed a bug where a file was never opened but was trying to be closed.