A thermodynamic framework is proposed to model the effect of mechanical stress and temperature on crack opening and closure in rocks. The model is based on Continuum Damage Mechanics with damage defined as the second-order crack density tensor. The free energy of damaged rock is expressed as a function of deformation, temperature and damage. The damage criterion controls mode I crack propagation, captures temperature-induced decrease of rock toughness, and accounts for the increase of energy release rate necessary to propagate cracks induced by damage. Crack closure is modeled through unilateral effects produced on rock stiffness. Simulations show that: (1) under anisotropic mechanical boundary conditions, crack closure occurs during cooling, (2) the thermo-mechanical strain energy necessary to close cracks during cooling is larger than the strain energy needed to close the cracks by mechanical compression. Parametric study highlights the thermo-mechanical stress redistributions occurring during closure. The proposed framework is expected to bring new insights in the design and reliability assessment of geotechnical reservoirs and repositories.