The issue is that the Loop node depends on the $runIndex property of the workflow, which is changed after the last Code node returns payload to the IF node.
The first outer iteration should go as intended, but the second one will break the Loop node, forcing it going directly to the done branch
Also, your sub WF will remove the execution data once the execution is finished, so it’s better to use the parent-sub workflows instead of the loop node.