A few more small cleanups
Finalize file opening