Happy Fourth of July!
As a side note, there's no law or regulation that allows you to terminate a lease because you bought a house.
Be sure to read your lease carefully. Last summer, I was selling a home and some renters wanted to buy it. They thought the penalty was 2 month's of rent. So they negotiated the price based on the assumption that they'd have to pay an additional 2 months of rent. (Put another way, they thought they'd be paying for both the rental and the new home for 2 months, overlapping.) Turned out they'd read their lease wrong, and it worked out to a 4 month penalty.
You certainly can try negotiating with the apartment complex management if it turns out that you can't afford to pay the penalty. But they're in a much stronger position than you are. And you may have additional problems: If the lease has a while to run, you may not qualify for financing on your home purchase due to double payments (rent and mortgage) you'd be paying at the beginning.
Just out of curiosity, why didn't this question occur earlier in the process?
Hope that helps.
At this point make sure you give a written notice and give at leats 30 days notice, if you can give 60 then do so.
You need to read you r lease carefully and see if there is anything in there that allows you to break the lease. If so use that to get out out of it.
good luck working things out and good luck with your new house.