Use python's "with" for f.open