Fix the memory corruption issues I had by renaming the data structure
(shadowing was causing the corruption!).
Also fix the Issue found by Hu Haipeng that a note ending in one
voice would terminate all ongoing ties in all other notes, since so
far the code never checked whether the starting note of the tie was
still going on.
Also, use the correct moment comparison (remove if the end moment is
lower **or equal** to the moment that has just been processed).