analogWrite on pin 9 uses timer 1. This interferes with your usage of timer 1.
As soon as counter becomes greater than 0, it crashes.
And I told you already that ISR's are not normal functions. This is also important if you use variables inside AND outside the ISR. You have to deal with atomic reading and volatile variables.