how to safely open/close files in python 2.4,f.close()