Using rwlock to protect syncing while writing, added a mlog message about closing a file that doesn't exist