Show close button when the dialog is about to end