The tenant's security deposit can only be used as rent if the tenant agrees to that. If the tenant doesn’t agree, then within 14 days after the tenant moves out you have to either return the security deposit in full, or provide the tenant with an itemized list of how the security deposit was used to cover damages, and then return the difference to the tenant if any.