We recently faced this problem (VFP 5.0) The solution we came up with was to get a look at all the open databases using the ADATABASES() function and then spin through and close the ones we didn't want open. There is probably a more elegant way of fixing this though. But, so far this has worked reliably for us.
Marty Smith, CSQE