Fix crash in removeOverlappingNotes function (midi import)

Interesting that this logical bug was revealed on MasOS only.