private void AfterFormCloseCleanUp()
 {
     if (!m_isDocumentClosed)
     {
         VerificationController.UnregisterInteractiveVerifier(
             m_verifier.GetType(), m_verifier.Document);
     }
     m_verifier.OnReleaseWindow();
     if (m_ptrOwner != IntPtr.Zero)
     {
         User32.SetFocus(m_ptrOwner);
     }
 }
        void ApplicationDocumentBeforeClose(Microsoft.Office.Interop.Word.Document Doc, ref bool Cancel)
        {
            if (!Doc.Equals(m_verifier.Document))
            {
                return;
            }

            m_cancelationPending = true;
            m_isDocumentClosed   = true;

            // Check if revisions are visible, if so make them invisible and turn them back on in the end
            if (m_isRevisionsEnabled)
            {
                DocumentUtils.ChangeShowingRevisions(m_verifier.Document, true);
                m_isRevisionsEnabled = false;
            }

            VerificationController.UnregisterInteractiveVerifier(m_verifier.GetType(), m_verifier.Document);

            ForceThreadsToClose();
        }