Changes to file open and close