The same argument can be made for the process of freezing: energy is put into a liquid during melting, so freezing the liquid into a solid again returns that energy to the surroundings. Like phase changes, chemical reactions can occur with the application or release of heat.