Check Engine Lights Turns on while pulling 3,000 trailer

I have a 2005 Ford F150 SuperCrew with 26K. While pulling my travel trailer (which is only about 1/3rd the max tow rating weight), the Check Engine Light came on. Per the Owner’s Manual, after 4 cold starts, it went off and I was not recommended to take it in to the dealer. Three weeks later, while pulling the same trailer, the light came on again but remains on after about 10 cold starts. The dealer put the truck on their scope and the following codes appeared:

P2004 (or PR2004) and P2005 (or PR2005), with this additional information: IMCR (or IMRC) is stuck closed and IMCR (IMRC) is stuck open.

There are no other apparent problems and the truck runs fine; no hetaing or idling issues, etc. When the dealer removed the scope, the Check Engine Light went off and remains off.

Can you explain what the problem might be as I’m fearful that the light will come back on again when I pull the trailer in a couple of weeks?