Contact the closing company immediately. They need to figure out what happened with the deed, but it sounds like the deed was transferred twice. One of the transfers was probably not correct. Once you figure out what is going on, you may need a real estate attorney to help sort things out.
The bank would much rather have your money from the short sale versus the foreclosure, but hopefully things can get worked out.