The free-ID search only consulted the global map, so it could pick an id the
same category still held further down the iteration - and renameTo silently
overwrites on POSIX, so the rename then destroyed that entry's file. It now
skips ids held by the category and any file already on disk.
Quests had the same discard-on-collision behaviour and now get the same
reassignment, including re-registering shared quests under the new id.