chg: using 'with open' for files