CAR REVING TOO HIGH WHEN STOPPED

2001 Saturn SC2 • 289,000 miles

2001 saturn. Check engine soon light comes on and car rev's when at a stop to 2rpm then down to 1rpm never goes below.
What is this and what should I do.I brought it in to have the machine find it and it say emissions so we later found that it was the gas cap not turned tight.
Now the cap is but it came back on.

Not sure if this has to do with it, but my 2001 Saturn SC2 was revving high how you are saying. It also would not start sometimes. It would act like it was going to start, and then wouldn't. Then it would start in 20 minutes or so like nothing was ever wrong. Eventually, the mechanic changed out the electronic control board that they had to get from Saturn and I haven't had any problems with the revving or the starting since they changed it out.