SyncDictFile: close the datafile before rename

The flush might only be done on close, which was done on scope end : ie *after*
rename.

As the flush might only be done on close, external readers might then only see
partial data, which defeats the whole purpose of the atomic rename().

This commit fixes this race condition.