Added missing ifs.close()