Fix testTypewriterAnnotTool
... by extending CloseDialogHelper to also handle dialogs without a parent widget.