They have every right to keep your deposit until the unit is re-rented...particularly if you do not keep paying the rent. What they do not have the right to do is to keep your deposit if there were no damages, AND you continue to pay the rent until the unit is re-rented.
If you do not continue to pay the rent, ultimately what is going to happen is that once the unit is re-rented, they are going to apply any non paid rent and damages against your deposit, and if that adds up to more than your deposit, then they are going to sue you for the balance.

