There are various ways of fixing the battery latch, Johnhu has pointed out a relevant thread.
But if you search for Battery Latch you will find many threads discussing it.
One of the more permanent fixes can be found in this thread,
Successful battery latch operation.
Check that your battery itself isn't bulging and causing the problem.
Some batteries can overheat and swell, if this is the case it should be removed and disposed of.