If they break the lease, you can keep the deposit. But for the last two month's rent, it will really depend on your state law. Also, as they have paid the last two month's rent already, they don't need to pay rent at the last two months.
I don't care too much about foreclosure, but more on other collections and bankruptcy.