High idle/car turns off

So I dont know if anyone has seen my progress on my 87 wagon but when I first started it (after putting in my integra battery and getting a new dizzy cap) it started up as though it hasnt been sitting out for a month. the only problem is that it initially revved to 2k rpm. i thought the idle screw had to be adjusted and that i would do it later. had to move the car around so I could work on the front end and clean up everything that was under the car. I started it up again and it went to 2k rpm like normal. except as it ran for a little bit, it climbed in revs, it went all the way up to 3k rpm before i tried adjusting the screw, which just made it go down a little bit. then as i got in the car to check how it was idling, i saw it go down (without touching anything) until it just turned off. I started it up again and it went back to revving higher and higher til it just shut off. I revved it to keep the engine on, and it worked but i didnt see the point in doing that over and over because there was something wrong, so i just shut it off
A couple things i am going to diagnose
1 make sure all the wiring connections are good.
2 make sure all the hoses are connected and there are no leaks.
3 check if I have the ignition cables in the right spots on the dizzy (although I dont think it is the answer to my problem, but it doesnt hurt to double check)
4 check fuses, I looked around and found that bad main relays are likely to be a culprit.
So far this is my list, if anyone has anything to add, please feel free to write in what you think is the problem.
THANKS!!! I hope this helps other people out too!
A couple things i am going to diagnose
1 make sure all the wiring connections are good.
2 make sure all the hoses are connected and there are no leaks.
3 check if I have the ignition cables in the right spots on the dizzy (although I dont think it is the answer to my problem, but it doesnt hurt to double check)
4 check fuses, I looked around and found that bad main relays are likely to be a culprit.
So far this is my list, if anyone has anything to add, please feel free to write in what you think is the problem.
THANKS!!! I hope this helps other people out too!
Comments
1)Possible Vac. leak.Probably not 'cuz the revs come back down.
2)Sensor malfunction or loose wire..