Landlords trying to keep the deposit – even when you leave the property in better shape that when you moved in – is nothing new.
It happened to us several times in the 1980s.
I came up with a solution though, and used it several times successfully. When the last month’s rent was due, I wrote the landlord a letter and told them to use the security deposit as the last month’s rent. They weren’t thrilled and they could still take us to court if we had damaged the property, but the places were always spic-n-span when we left so we never had a problem.
It basically turned the tables: they would have to take me to court and defend their deductions of the deposit, as opposed to me having to take them to court to get my deposit back.