Code gets stuck on the last note of the melody after being played

Yeah, the note durations array was 1 off, so just adding an extra duration removed the error. Also managed to fix all of the bugs, so the whole project is complete now.