Fix close dialog +  add assert