Coupling of thermal mass with night ventilation in buildings