Fixed close dialog bug