Control of magnetic actuators in electric contactors by current shapping