add multiple email addresses to lead in code

I have a custom scheduler that does a bunch of stuff and then needs to loop through a number of email addresses and add them to a newly created Lead with id $lead_id.

The addresses may or may not already exist.

The following will add the email addresses and relate them to the Lead but it will also set all but the last email address added to deleted = 1

Why?

      foreach($all_email_addresses as $address){
        if(!empty($address) && !empty($lead_id) && filter_var($address, FILTER_VALIDATE_EMAIL)){
            $sea = new SugarEmailAddress;
            $sea->addAddress($address, $primary); //add as primary
            $sea->save($lead_id, "Leads");
            $primary = false;
        }
      }

Sugar v7.9.4 but will also need to work in v8.1

thanks,

FrancescaS