Two things involved here.
The starter circuit, that is the signal from the key switch to the solenoid, that makes it engage.
That current energizes the coil in the solenoid which pulls the Bendix gear out to the Flywheel and also provides voltage to the Starter motor.
If you have turned the key off and it still is cranking, than this is not the problem.
Pull the Starter out and check the Bendix to see if it is free to return.
It works by the Starter motor spinning it out to the Flywheel and then the starter spins the engine until it starts.
Sometimes it sticks when it is spun out on to the Flywheel and will not return when the engine starts.
You should be able to pull the gear out to the end and when you let go, it should just spin back out of the way.
Cleaning the shaft and gear will usually fix this.
Ray in Sunny Mena...