Thermal fracturing on comets. Applications to 67P/Churyumov-Gerasimenko