Fix if close problem