Creating and using multiple database-components

I'm working on a MDI-application where each 'document' has it's own
database-components (Access). I'm creating TDatabase components and
related TTables on the fly and everything goes just fine until it's time
to close the whole application: an access violation comes up. Execution
point is not available but I have traced the problem to the thread which
is internally created when the first database connection is established.

All database-objects are freed with their MDI-childwindows and the
problem arises only when one or more childwindows have been opened AND
closed before closing the application. Is there something that keeps
track of databases created that needs to manually updated when closing

I'm currently using single session for all database-connections, I tried
to use multiple but that didn't help.

Thanks for any help!

Example code:
// creation
Database := TDatabase.Create(nil);
Database.DatabaseName := 'TEST';
Database.DriverName := 'MSACCESS';
Table1 := TTable.Create(nil);
Table1.DatabaseName := 'TEST';
Table1.Active := True;

// freeing
Table1.Active := False;

Henri Suuronen