improved dialog close