Added locking around writing mapheaders, renaming, and rm -r

- Locking is now done based on a hash of the filename
- Fixed bugs related to tracing renames