Satisfy critic - use local variable file handles.

Use local variable file handles rather than bare word form, and use the
three argument form of open().