Could you use `with open(fname) as file:` here instead?