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

when you say your code stops durring the noise i would assume the problem is in the
buzzerTune() function

When you say it stops at the last note, look at the last note. it is zero.
zero is a time increment for your pitch. if you ask for a pitch to move at zero. it will take exactly forever to complete. LOL.