More file handling cleanups