Diesel engines are shut off by a fuel cut off. Older tractors have a manual cutoff cable attached to the injection pump and the newer machines have a normally closed solenoid valve that is opened with the key switch when it's in the START and RUN positions.
From your decription, you have some sort of intermittent problem with the circuit to the solenoid. Find a wiring diagram and see what's in that fuel cutoff circuit. Maybe you have a relay that's faulty,etc. Most of the safety interlocks are in the starter circuit so so I don't suspect that to be the problem, but then I'm not familiar with your particular machine.
It's also possible that if your machine has glow plugs for cold starting or electronically controled fuel enrichment, etc , and an element in that circuit has failed or is turning off too quickly, causing the engine to die. After 8-10 starts the engine then has the ability to run unassisted.
Look in your manual for cold starting devices, etc in the fuel system section. Also read your operators manual.It sometimes explains special procedures for starting in cold weather.