Dialog close bug fix