To stop the locomotive, the armature circuit was opened by the main switch, stopping the flow of 
(the armature circuit; was opened; by the main switch; stopping the flow of)
the armature circuit
was opened
by the main switch stopping the flow of