So, what ever is connected to the ignition switch on the "S" terminal is what is required to keep the engine running.
When you release the key it goes back to the "R" position. It would seem you need the wire that is on the "S" terminal on the "R" terminal.
That would mean some of the wiring is wrong, shorted ??