There shall be no recovery of possession under this chapter if the amount found by the court to be due the landlord equals or is less than the amount found to be due the tenant or occupant by reason of any counterclaim or defense under this section. If the amount found to be due the landlord exceeds the amount found to be due the tenant or occupant, there shall be no recovery of possession if the tenant or occupant, within one week after having received written notice from the court of the balance due, pays to the clerk the balance due the landlord, together with interest and costs of suit, less any credit due the tenant or occupant for funds already paid by him to the clerk under this section. In such event, no judgment shall enter until after the expiration of the time for such payment and the tenant has failed to make such payment. Any such payment received by the clerk shall be held by him subject to the provisions of the preceding paragraph.