Anisotropic thermal properties and ferroelectric phase transitions in layered CuInP2S6 and CuInP2Se6 crystals