OS level file access and file in use error

In Delphi 1 I am using XCeedZip (Zip Achiver component) in a routine to
backup the data directory of an application.  The main form of the app has a
few table components on it with the Active property set to True at
design-time.  As expected, when I run the backup routine I receive a number
of white error boxes stating that a file is in use.  When I set the tables'
Active property to false at design-time, the problem goes away.

I do not really care to set those tables' active properties to false since
other forms in the set use them and assume they are active.

I thought I could just close all of the tables during run-time, maintaining
a list of tables deactivated as I do it, just before I execute the backup
routine.  Then after the backup routine, re-open the tables as listed during
the close routine.  I tried to write the routine to be generic so it would
close all active tables and subsequently re-open them.

While this code seems to close the tables, as seen by DatabaseCount reaching
0, I still get the 'file in use' error from the backup routine.  Why isn't
the closing of these tables at run-time the same as setting their Active
properties to False at design-time.

Any thoughts would be appreciated.

Here is a code snippet of my close routine...

-----------CODE SNIPPET-------------

DataSetsInUse: array[0..99] of TwwTable;
DataSetsInUseCount: Integer;


{ close all open datasets in the main database and save a
  list so they can be reopened after we are finished with the dataset
  files. (the files as accessed from the OS)
  Created: 03/06/1998
  Written By: SJM


procedure TUtilsF.CloseDBDataSets;
   DBNdx: Integer;
   FndDB: Boolean;
   DBNdx := 0;
   DataSetsInUseCount := 0;
   FndDB := False;

   while (DBNdx < Session.DatabaseCount) and (not FndDB) do
      { only close from the main database }
      if Session.Databases[DBNdx].DatabaseName = MAINDBALIAS then
         FndDB := True

if FndDB then
       with Session.Databases[DBNdx] do
           while DatasetCount > 0 do
               DataSetsInUse[DataSetsInUseCount] := TwwTable(DataSets[0]);
               DataSets[0].Close;        { this has a side-effect of
decrementing DatasetCount }
         end; { while DatasetCount ... }
      end;     { with Session.Databases[DBNdx] ... }
   end;      { if FndDB ... }

-----------END OF SNIPPET------------

Scott Millhisler
SJM Computer Consulting, Perry Michigan
Ph: (517) 625-7121