Improved isDialogOpen()