Fix for #82687322. Store the removed node in a local variable then remove it from the array and then use the local reference for event firing.