This could be replaced with `Dialogs.cancelModalDialogIfOpen` if it could receive an additional and optional button ID parameter.