Hi, I'm Heather, an attorney for 15 years and I'd like to assist you for informational purposes.
If you had simply moved out and broken the lease, the landlord would have obviously had damages but he would have also had an obligation to mitigate his damages - meaning use reasonable efforts to find a new tenant. After he found the new tenant, you would have been responsible for his lost rent during the time the apartment was vacant, lost commissions during the time the apartment was vacant, and if he rented the apartment for less, you would be responsible for the difference between your contract rent and what he actually rented the apartment for. You would have also been responsible for damages to the apartment, if any.
That was not the situation here. Instead, when you moved, you signed a new agreement with the landlord. This new agreement made you responsible to pay certain items and, in return, your landlord agreed not to sue you for certain items. You had to pay the $1650, $500, and $990, but in return, your landlord promised not to sue you for other things he could have potentially been entitled to if he wasn't able to rent the apartment out to someone new - like lost rent for 6 months, or if he rented it to someone else but could only get a lower rent, he would not be able to sue you for the difference.
So, long story short, you made an agreement when you moved out, and that is what the court will be enforcing. I hope that this information has been useful. Please let me know if I answered your question