A lit candle needs to draw oxygen from the air in order to continue burning. If you limit the amount of air available, the candle's flame eventually goes out once it uses up all the oxygen. Lit candles in smaller jar stop burning first because the oxygen trapped in the jar are fewer than the ones in bigger jars.