Check engine light on for three weeks. Then goes off
The check engine light is on for a reason. The car’s computer stores codes when it happens. Have the code(s) read by a mechanic or auto parts store and it will tell you what’s happening, then you can have it fixed. If you want more advice, post the code(s) here. But don’t just ignore it.
So maybe you tightened your gas cap better the next time you filled the car up. That’s my WAG.