close dialog after adding a class