         } else {
             MusicTrackSetProperty(track, kSequenceTrackProperty_TrackLength, &durationAsMusicTimeStamp, size)
         }
+        
+        MusicSequenceDisposeTrack(newSequence, newTrack)
+        DisposeMusicSequence(newSequence)
     }
 
     /// A less destructive and simpler way to set the length

            clear()
            MusicTrackSetProperty(track, kSequenceTrackProperty_TrackLength, &durationAsMusicTimeStamp, size)
            MusicTrackCopyInsert(newTrack, 0, durationAsMusicTimeStamp, track, 0)
            MusicSequenceDisposeTrack(newSequence, newTrack)

            DisposeMusicSequence(newSequence)

            //now to clean up any notes that are too long
            var tempIterator: MusicEventIterator?


        MusicSequenceNewTrack(newSequence, &tempTrack)
        guard let newTrack = tempTrack,
            let track = internalMusicTrack else {
            return
        }
        MusicTrackSetProperty(track, kSequenceTrackProperty_TrackLength, &durationAsMusicTimeStamp, size)
