Update file opening/closign using "with" instead of "try..."