Open and close the dialog.