P0740 is an issue with one of the solenoids in the solenoid pack in the transmission pan
I had multiple P0700 codes (P0750, P0740, P0760) my issue turned out to be my TCM computer was not providing power to the solenoid pack which made all these solenoids fail and the jeep was stuck in 2nd gear. so I replaced the TCM and that fixed it. but yours seems to be just 1 solenoid so it seems you're getting power down to the solenoid pack.
if you keep clearing the code and it keeps coming back you may have to replace the solenoid pack
I made a video here on how to change it, as I thought this was the fault on my jeep before trying to replace the TCM
all the parts needed are in the description on the video.