If it's working correctly on each ball draining up to ball 5, then that kinda suggests it's in 6th position/game over territory.
There are two paths to advance the Ball Count unit. The one being used for the five balls is via the trough switch (each time the ball rolls over the trough switch to the plunger, the Ball Count unit advances).
The other path to advance the Ball Count unit is used after ball 5 drains, and this steps it to the 6th position, putting it at Game Over.
Usually though, when it doesn't advance to the 6th position/game over, an 'extra' ball is kicked out to the plunger, which is what causes it to finally reach game over (because it's using the trough switch one more time), and the playfield is dead.
Since in your case ball 5 drains but doesn't kick out the ball and also doesn't reach game over, that makes me think that either the 6th position switch is opening early (at the 5th position), or that perhaps it really is stepping to the 6th position, and the Game Over light is out, or there's some other clue to note still.
After ball 5 drains, is the playfield still working? (flippers active, e.g.)