Matter is anything that has mass and occupies space. The flame itself is a mixture of gases (vaporized fuel, oxygen, carbon dioxide, carbon monoxide, water vapor, and many other things) and so is matter. The light produced by the flame is energy, not
matter. The heat produced is also energy, not matter.