You may check is there anything in the contract allow them to charge them money. It depends on what kind of deal you got and how much you like it. You can walk away with only around $1000 lost, but on another hand, they have to fins another buyer and whole bank approval. It takes times and sometimes they do not have the time if there is a foreclosure date been set.
Calm down. talk to the agent for the reasons, consult a real-estate layer. You may consider hire a attorney in this type of transaction.
I am not a expert though.