DB2 CLI: Resource Leakage problem?

I have a function that replicates the data from a collection of Paradox
tables to a corresponding collection of DB2 tables. I am using Delphi 3 C/S.
Two problems:

First, if a disconnect from the database then reconnect, I get an access
violation (a la GP Fault). Second, after repeatedly closing and opening
tables, I get a Windows out of resources error. Is there a memory leakage
problem here, or am I doing something wrong? Here's what the code looks
like:

procedure TfrmDataConnectivityManager.DoUploadTable( const aTablename:
String; doDelete, doUpdate: Boolean );
var
    sourceTable,
    destTable:      TTable;
    myQuery:        TQuery;

    recordCount:    Longint;

begin
    recordCount := 0;
    sourceTable := NIL;
    destTable := NIL;
    myQuery := NIL;

    try
        // Delete destination records.

        if ( doDelete ) then
        begin
            StatusBar.SimpleText := 'Emptying destination table ' +
aTablename;

            myQuery := TQuery.Create( Application );
            myQuery.databaseName := 'TESTDB';
            myQuery.SQL.Clear;
            myQuery.SQL.Add( 'DELETE FROM ' + aTableName );
            myQuery.ExecSQL;
        end;

        // connect to destination database.
        if ( doUpdate ) then
        begin
            StatusBar.SimpleText := 'Opening ' + aTablename;

            sourceTable := TTable.Create( Application );
            sourceTable.DatabaseName := 'ALIADO';
            sourceTable.TableName := aTableName;
            sourceTable.TableType := ttDefault;
            sourceTable.indexName := '';
            sourceTable.Active := TRUE;

            destTable := TTable.Create( Application );
            destTable.DatabaseName := 'TESTDB';
            destTable.TableName := aTableName;
            destTable.TableType := ttDefault;
            destTable.indexName := '';
            destTable.Active := TRUE;
            // Upload records

            StatusBar.SimpleText := 'Uploading data for ' + aTablename;
            sourceTable.First;
            while ( not SourceTable.EOF ) do
            begin
                Inc( recordCount );
                if ( ( recordCount mod 10 ) = 0 ) then
                    StatusBar.SimpleText := Format( '%6d records transmitted
to %s', [ recordCount, aTablename ] );

                DoUploadRecord( sourceTable, destTable );
                sourceTable.Next
            end
        end;

    finally
        StatusBar.SimpleText := '';

        if ( doUpdate ) then
        begin
            if ( sourceTable <> NIL ) then
            begin
                sourceTable.Active := FALSE;
                sourceTable.Free
            end;
            if ( destTable <> NIL ) then
            begin
                destTable.Active := FALSE;
                destTable.Free
            end
        end;

        if ( doDelete ) then
            if ( myQuery <> NIL ) then
                myQuery.Free
    end
end;

procedure TfrmDataConnectivityManager.cmdUploadPermanentClick( Sender:
TObject );
begin
    try
        if ( DoMakeConnection( FALSE ) ) then        // connects
testDatabase
        begin
            DoUploadTable( 'APPOINTMENTSTATUS', TRUE, TRUE );
            DoUploadTable( 'LOGTYPES', TRUE, TRUE );
            DoUploadTable( 'MOP', TRUE, TRUE );
            DoUploadTable( 'NERDHELP', TRUE, TRUE );
            DoUploadTable( 'PAYMENTREVERSERESN', TRUE, TRUE );
            DoUploadTable( 'POSHARDWARE', TRUE, TRUE );
            DoUploadTable( 'REVOKECREDITREASON', TRUE, TRUE );
            DoUploadTable( 'SALESTAXLIST', TRUE, TRUE )
        end;

    finally
        testDatabase.Connected := FALSE;
    end
end;