Since I'm not a party to either contract I will only be able to speak to you in general terms.
When you are renting a property you have a lease agreement. It states who you make your payments to, for how much, when it is due, and so forth. You may have a security deposit as well. If you are buying the property you are renting then you made an offer to the seller with a purchase contract and that contract also has terms you agree too.
In brief with things being as simply as possible. You would pay your rent as agreed, the escrow company would prorate the rent with a credit back to you along with a return of your security deposit.
This need to be put in writing and all parties need to agree to it. Since it is a short sale it is very important that your agent handles it properly because the Seller's bank has to understand what the credit is for and they have to agree to it. They will probably want to see documentations of cancelled checks.
Again, this is in general terms and please talk with your agent.