hmm, CLOSE DATA should work in main.prg, but I usually use it to close all free tables. Make sure the DBC is selected when you close data.

Here's a blurb I found on using CLOSE DATA in various scenarios:
"
If you have two open databases (DBCs), how many of them would you expect the CLOSE DATABASES command to close? If
your answer was "both of them," you're in for a surprise. CLOSE DATABASES works only on the "current" DBC (as shown in
the drop-down list on the VFP standard toolbar), closing the DBC and any associated tables and indexes. It doesn't touch
other DBCs and their tables, nor does it affect free tables. However, here's an exception: if there's no "current" DBC, then
CLOSE DATABASES will close all free tables instead (for compatibility with the behavior of earlier FoxPro releases). To close
more than one DBC, use CLOSE DATABASES ALL, or use SET DATABASE to make the appropriate DBC "current" before
using CLOSE DATABASES."

Following your solution, i've added into my main.prg CLOSE DATABASES ALL and later SET DATABASE TO mydatabase ; CLOSE DATABASES but with both methods the dbc file (that i don't use but it was called by dbf files) stay always in use.
I noticed that when i close my browser, IIS release the file but this isn't a solution for me because if another user is browsing my site, i can't sync...