TIP120 Transistor + Solenoid Failing Randomly
I don't see any decoupling capacitors on your ICs on the veroboard. PSU noise could be causing false outputs from your logic. Try putting 100nF capacitors from ground supply pin to power supply pin on each IC. Keep the leads as short as possible, put them on the copper side of the board if this helps you to meet this objective.

Without these capacitors the supply voltage at the IC pins can drop to a level where the behaviour of the ICs is non deterministic over very short timescales. The faster the logic family the worse the problem gets.