Although this is a simple law of physics, it can be applied to a given chemical system. During a chemical reaction, although the different types of energies do not remain constant, the total energy does. This is known as the Conservation of Energy. Whether a reaction is exothermic or endothermic, the energy within this given system is conserved. Given that the Conservation of Energy applies, and no energy is transferred outside of the system, then the system is truly closed if the Conservation of Mass also applies, which means that the mass of the products must equal the mass of the reactants.
Consider the combustion of methane:
CH4(g) + 2O2(g) --> CO2(g) + 2H2O(l)
The mass of the reactants is 12+4+64 = 80 amu
The mass of the products is 12+32+36 = 80 amu
In this closed system, the mass of the reactants equal the mass of the products.
Thus understanding that mass is conserved, in conjunction with energy, is crucial to understanding the thermodynamics of a closed system.\
Title Image Credit: Wikimedia Commons