Subaru Outback with hiccups

The engine runs steady, and I haven’t noticed any change in rpm, except if I take my for off the gas pedal. There is no different sound in the engine either. The check Engine light is on, but it has been on for ages- if the gas cap isn’t tightened enough (3+ clicks) the light comes back on. Mechanics have reset it any number of times and say it is not the engine. However, the engine at this point is having leaking seals on the back wall, and we have been trying to find out if the transmission needs repair before doing that, as it will save about $500 not to have to drop the transmission separately, i.e. twice. I am very interested in your thoughts, Goldwing.