title: Visio prompts me to save document when I close it although I just saved it
body: <p>I wrote a Visio 2010 Add-In(in C#) which processes many Visio documents. Within a Ribbon1.button1_Click the method I invoke a new thread(processVisioFiles) which processes all vsd files in a big loop (which takes over 40min). </p>
  
  <pre><code>public partial class Ribbon1
  {    
      private ThisAddIn exportAddIn;
      ...
      ...
      public Thread StartTheThread(DirectoryInfo startFolder, bool someVal)
      {
          var t = new Thread(() =&gt; exportAddIn.processVisioFiles(startFolder, false));
          t.SetApartmentState(ApartmentState.STA);
          t.Name = "processVisioFiles";
          t.IsBackground = true;
          t.Start();
  
          return t;
      }
  
      private void button1_Click(object sender, RibbonControlEventArgs e)
      {                             
          //exportAddIn.processVisioFiles(startFolder, false);                   
          StartTheThread(startFolder, false);         
      }
  }
  </code></pre>
  
  <p>Every time before I programmatically close a Visio vsd document I do <code>document.Save()</code> and then <code>document.Close()</code>. Nevertheless, they are many documents (not all but always the same) which prompts me to manually save them.</p>
  
  <p>I need to say, that I haven't the problem with manually save the documents when I start the big loop within one thread with the UI</p>
  
  <pre><code>private void button1_Click(object sender, RibbonControlEventArgs e)
  {                             
      exportAddIn.processVisioFiles(startFolder, false);
      StartTheThread(startFolder, false);
  }
  </code></pre>
  
  <p>but then Visio UI is freezing("Application is not responding" message) and after a certain time, Visio aborts the loop through all files. </p>
  
  <p>I tested to save with <code>document.SaveAs(...)</code> and document.SaveAsEx(...) and </p>
  
  <pre><code>if(document.Saved == false) 
  {
      document.Save(); 
  } 
  document.Close(); 
  </code></pre>
  
  <p>but the result is the same. Every time the same Visio files aren't saved and remain unsaved and the UI prompts the user to save or discard manually the changes.
  How can I programmatically save and close without prompting the user to do this manually?</p>
  
  <p>p.s. Besides (when I'm in debug-mode) I waited a certain time after document.Save() and then step to document.Close() line, but the result is the same. </p>