Compacts away the gap which will form in non-aggressive (regular) mode
when batches are read in from disk.
The gap will contain already used IDs so it is important to remove it
on a clean shutdown. The freed IDs will not be reused after an
unclean shutdown, as guaranteed by the external user.
Below diagram tries to explain the situation
S = old IDs which are still free (on the Stack)
G = the Gap which has formed, due to consuming old IDs
N = the New IDs which have been freed during this run (will be compacted to the left)
stackPosition
v
[ S S S S G G G N N N N N N N N ]
^
initialPosition
After compaction the state will be:
[ S S S S N N N N N N N N ]
and the last part of the file is truncated.