Avoiding duplications

in this workflow there is no way to avoid duplication if the process stops, any ideas?

same happens to this workflow

i went with this to avoid duplication and n8n crashing, after each batch done reboot n8n