Try removing it then placing it back into place firmly and see then if the light goes out after a bit of driving but it should go out right away if it was just a matter of the cap being slightly loose etc.Otherwise the cap's seal is gone and you need to replace the gas gap and if so you minus well by a locking gas gap bec they don't cost much maybe 10 to 20 bucks.
Hope that helps and best of luck.By the way a loose gas cap causes pressure changes etc and that's why the engine light code error.