This might be totally unrelated but I had a Dodge truck do that and the speed sensor was the culprit.
It was in the rear differential.
If your speedometer doesn't work that might be a clue.
On this one it calibrates the idle air control after receiving the speed signal.