Check the hint above the door. Light numbers mean lighting a candle. Other numbers mean turning off a candle by tap.
1 means the left candle, 2 means the middle candle and 3 means the right. So you need to light up 2nd, 1st and 3rd candles by lighted wooden rod at first.
Then tap 3rd and 1st candle to put out the fire.
Use the lighted wooden rod again to light up the 1st candle.
Tap the 1st and 2nd candles to quench the fire. Escaped.