Import - Update Matching Records - not working for consecutive records in source file
I am importing a source file of contacts that contains many duplicate contacts. Some duplicate contact records are identical and some are slightly different but with the same email address. I want to eliminate duplicates during the import process, keeping the data from the latest records and overwriting data from older records. The source file is sorted in chronological order, oldest records first, to newest records at the bottom. The older records may be incomplete so I want them updated with information from the newer records.
I do observe that when duplicate contacts that are not identical appear several records apart in the source file, the older record does in fact get updated with the info from the newer contact record.
My problem: But it appears that when the duplicate contact rows are consecutive (i.e. next to each other) and identical, both records get added to the target table.
Question: How do I get the second record to not be added?
Here's my script: