Here are your parts
Replacement parts for WHIRLPOOL TEDS740PQ0 29"ELECTRIC DRYER | AppliancePartsPros.com
See the attachment for the wiring diagram.
If when it was not turning off you did not check it in timed dry then there is a possibility that replacing the heating element will also fix the unit not shutting off.
In auto modes the timer motor gets power through the heating coil when the coil is shut off. So depending how the coil failed it could have been stopping the timer from advancing.