What is the charging current?
How long is the battery charged?
ie how much time is the charger supplying current.
Short circuiting is an unusual failure mode for a battery.
Could it be that the plates are bucking due to severe overcharge?
( A note on English grammar, "the battery weaks" is a strange expression, it would be better to say "the battery weakens", or even better "the battery fails" )
If you read the LM317 datasheet it states that the regulator is over current and over temperature protected by its internal design.
I doubt that a fuse would be any improvement.
As suggested by Nigel, a fuse may be better placed earlier in the circuit, before or just after the transformer.
My choice would be to put the fuse in the incoming mains supply.