The substance that reacts with the candle wax is oxygen. It comes from the air. Putting the jar over the candle keeps oxygen from outside the jar from getting in. The reaction can only use the oxygen ...
It lets candle light out and uses the heat from the candle flame to generate power for the LEDs ... Meanwhile, the candle is beginning to starve for oxygen. Once the air cools down a bit ...