[libcontacts] Prevent crash in coalescing import contacts. Fixes JB#12291

Remove obsolete contacts only after traversing indexed contact list.
Do not add multiple instances of contact nickname.
Do not use shadowing variable name.