An ISA ends in one of two ways. The first way is hitting the repayment cap. If you make payments up to the repayment cap, your ISA will automatically terminate even if the ISA length hasn’t fully elapsed.
The second way to end an ISA is if the length fully elapses. For example, with a 2 year ISA, the ISA will automatically end after 24 months of payments, no matter how much has been paid back. You may even repay less than you borrowed!