It sounds like it could be dieseling, this is when a car runs lean, the valves get too hot, and when you turn the key off, it runs roughly for a while. This can also happen if you get carbon buildup on the top of the pistons. It'll make bad sounds til it finally dies. You can usually tell pretty easily if this is the problem, pull all of the plugs( one at a time) and look at them..they should be light brown, a real light brown or white color indicates a lean condition. It's possible for the front three to be different from the rear three cylinders.
Another thing you could try, remove the battery ground while the car is running, then turn it off. It'll remove all chances for an electrical problem to turn the starter on.
Chrome