As you can tell this is a very difficult question to answer without reviewing your actual contract. I'd have my attorney take a look at the contract to determine if there is a specific time frame dictated by your purchase agreement by which the seller would be required to return your earnest monies.
And I would assume that the provisions of your purchase agreement with the seller are still enforceable on you until the contract is actually closed. Even when you have a buyer willing to assume your contract, you're usually not "off the hook" until the deal is actually completed (unless both sides agree to an earlier release of funds). Your attorney would be able to advise you most appropriately, and if you don't yet have a real estate attorney, then you should get one right away. Good luck.
Broker Associate, Sudler Sotheby's International Realty
Did you have any sort of written documentation of discussing this agreement? Go back and read through it and I would suggest you consult with an attorney. If you had a real estate attorney involved in any of this, go back to him/her. If not, I suggest finding an attorney who can assist you in this.
I hope all goes well!
Keller Williams Realty