Improve dialog close