Created a new private method isDialog() that isDialogOpen uses to correctly assess if a dialog is open or not