processPendingChanges copies the pending keys into a new set to prevent a 'mutated while being enumerated' crash