Cosmological Constraints on Thermal Friction of Axion Dark Matter