TDatabase objects created at run-time

I have a DLL where one or more TDatabases are created at run time,
and when the DLL is unloaded, I'm getting run-time error 216 (AV).
I've traced it down to when DBTables is being finalised: When the Sessions
list is freed, it frees the associated TDatabases.

If there is more than one TDatabase, when it gets to the 2nd (and also
last one in this case), it appears to {*word*88} when calling DBICloseDatabase.
As I dont have the code for the BDE unit, I'm stuck as to why this behaviour
is occurring.

If anyone has any ideas, let me know. I'll post the code where the TDatabase
objects are created if needed, however I'm sure it's probably something
simple.