Fix dialog close issue