Fixed with statement for Py2.5