Cannot Create Form Error when Closing Forms

This one is driving me crazy.  I have an MDI application that has
child windows which contain a page control,  Each tab sheet then
contains another form.  All of this works great.  I can open and close
forms all day long without a problem.  That is, until I try and
terminate the application with one of these child windows open.  When
I do that, I get the following error:

        Exception EInvalidOperation
        Cannot create form.  No MDI forms are currently active.

I imagine this is coming up when the application is closing because
the MDI parent window is already "gone" by the time it is closing the

When the child is closed, it in turn closes all the embedded forms on
the page control.  It is on the close of the first of the embedded
forms that the error happens.  If I don't explicitly close the
embedded forms, then the error happens when I exit from the
FormClose() method of the MDI child.

My question is, what could be happening during a form's Close() method
that would make it think it needs to create an MDI child form?  I
don't have any FormClose() method defined for any of the embedded
forms, so when I single step into that call, that's when the error
pops up.

Can anyone shed any light on this?

Clayton Neff
Software Project Leader
The Personal Marketing Company, Inc.
11843 West 83rd Terrace
Lenexa, KS  66214