Welcome in the forum.
When you set the compare value to something that is actually larger than the current count, the counter will count down to zero and a new cycle is started. This will introduce flicker.
Your loops are executing a lot faster than the PWM clock runs. I would suggest you to try making a breathe on or off in a fixed time given as 0.5 seconds using a 1ms timer with an interrupt. This would allow the CPU working on some other jobs in parallel.
Now i increased the pwm-frequency and it works fine :-)
Please can you explain exactly, how it should work with the timer interrupt? Do you have an example?