Closed input/output files

Untested