Great opportunity for the "with" statement. Currently if an exception is raised on the next line, the file handle might not get closed until the apache process gets recycled. And for us, that means never. In addition to just being slick, the "with" statement takes care of the close() no matter what.