Thermal properties of layered transition-metal dichalcogenides at charge-density-wave transitions