Arduino- Duty Cycle Changing When Frequency Is Increasing
If you look at the Timer1.pwm() function call you will see that you are providing two timing parameters: the duty factor and the period. Both of these are specified as an integer number of clock cycles...the duty factor is not given as a percentage of the period.

So, when you change the period the output pin stays high for the same number of clock cycles that you specified in Timer1.pwm(), which effectively changes the duty factor. If you want to keep the duty factor constant then you need to call Timer1.pwm every time you change the period and give it a newly calculated value for the second parameter.