The number of gas molecules in a closed vessel does not increase when heated. Why, then, the gas pressure in the vessel increases?

the number of molecules in the vessel will not change with increasing temperature, but their speed will increase, impacts collide more often and stronger, therefore the pressure increases.

Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.