I have had a look at the problem a bit more closely. It is not the battery - I have 3 and they all wobble. With the battery not in place I cannot push the bolt in. I can just about do it with a battery but do not like to as I can see it scraping away the plastic on the battery. When I twist the key it gets stuck at one point and then jerks open when I apply more force. WD40 does not seem to help.
I can see 2 bolts on the lock. The second one pushes up quite easily, it is the first one that does not move far enough. Why are there 2 bolts? Only the first one goes into the groove at the top of the battery. Perhaps there should be something on the second bolt that should locate in the groove as well, but is now worn away?
The bike is over 7 years old now and has done over 20,000 miles so bits are wearing out. Are replacement locks available?