Correct file open and close commands