index: fix index merging on windows

On Windows:
- Opened files cannot be moved
- Move will fail if destination exists

This revision adds error checking when the new index is replacing the
former one, and makes merge() release its opened files/mmappings.

The following sequence will now correctly work on Windows:

  $ cindex a
  $ cindex b

instead of silently failing to update the index with b content.