Error trying to submit webform programatically multiple times: Duplicate entry for key 'PRIMARY'
Not entirely sure why, but moving the line that sets $submission_out inside the loop fixes this problem.