clean up how files are opened