Move '++next' (when sorting marker labels) so there's absolutely no chance of incrementing it once it reaches the list end
Close a temporary file as soon as we know we've created it (the function which needs the file will re-open it itself)