title: "Cannot create form. No MDI forms are currently active" error
body: <p>I have a MDI main (parent) form and a MDI child form. I create the child at runtime like this:  </p>
  
  <pre><code>VAR
     FrmDereplic: TFrmDereplic;
  
  procedure TMainFrm.Button2Click(Sender: TObject);
  begin
   FrmDereplic:= TFrmDereplic.Create(MainFrm);
   FrmDereplic.Show;
  end;
  </code></pre>
  
  <p>Steps to reproduce the error:<br>
  I start the app, I press the button to create the child, I press the 'x' button on main (parent) form to close the application and I get an "Cannot create form. No MDI forms are currently active" error.</p>
  
  <p>The line on which the error appears is in the child form:</p>
  
  <pre><code>procedure TFrmDereplic.FormClose(Sender: TObject; var Action: TCloseAction);
  begin
   Action:= caFree;
  end;
  
  procedure TFrmDereplic.FormDestroy(Sender: TObject);
  VAR MyIniFile: TCubicIniFile;
  begin
   MyIniFile:= TCubicIniFile.Create(AppINIFile);
   TRY
    with MyIniFile DO
    begin
     if WindowState&lt;&gt; wsMaximized then
      begin
       // save form's screen pos
       ...
      end;
     WriteInteger  ('Dereplicator', 'fltExtensions', fltExtensions.ItemIndex);  &lt;----- HERE
   FINALLY
    FreeAndNil(MyIniFile);
   END;
  end;
  </code></pre>
  
  <p>I save lots of form's properties (and other's controls properties) to the INI file. But it only fails when I try to save fltExtensions.ItemIndex (which is a TFilterComboBox). If I comment that line it works perfectly.</p>
  
  <p>Any idea why it tries to create a form when I actually closed the application?????????</p>