Why do tealights burn violently when nearly burnt out
There are two factors that probably matter here. One is that, for most of the life of the tea light, only a small amount of wax is liquid and actually burning. Most of the flame is liquid wax burning in the wick with a small pool of liquid wax below the wick. But later, when most of the solid wax has gone all the wax will be liquid. The second is that the matchstick can act as a second wick.

When the wick is still vertical (and held there by the presence of solid wax) the area of melting is kept small as the flame is vertical and the area of melting is constrained. Later, the wick may fall over as there isn't enough solid wax left. Also the heat can spread wider as the volume of wax decreases as it is also conducted more effectively through the aluminium container (wax isn't a good conductor of heat). The net result is more liquid wax near the end of the candles life. 

Then two other factors may intervene. If the wick falls over, there is now a larger area of wick where burning can happen and the whole wick (not just the tip) can burn. Sometimes the matchstick will now also act as a wick, increasing the area of flame. Both these effects make more flame and more heat in a sort of runaway reaction which might also cause enough heat to reach the flash point of the wax leading to an even bigger flame. Even if the flash point isn't reached, the flame from a bigger wick area and a match acting as a wick can be a lot bigger than the flame form a normal vertical wick.