Changed f.read and f.close by t.read and t.close