Fix deadlock on remmap.

This commit fixes a deadlock situation that can occur when Bolt's database size crosses a threshold and requires remapping the mmap.

See inline comments in the code for a better understanding of what's going on.

/cc @snormore @mkobetic