Double closings happen all the time and are legal. However, double contracts are not legal and highly unethical.
A double closing is the simultaneous purchase and sale of a real estate property involving three parties.
The most common double closing is when the seller of your home is waiting for you to close, because they are going to take the profits from the home sale and use them towards their new home they have purchased.