The deposits that you give at the contract to purchase and signing of the P&S are to protect the seller in the event that you back out for any reason other than one specified within the contracts ( Home inspection, Mortgage contigency etc...). Assuming that the deal will go through, the listing broker that is holding these funds will be resposible for bringing them to the closing. They will be appliied to your side of the closing in the form of a credit on the buyer's side of the HUD-1 settlement statement.
In other words if you gave 4% to be held as a deposit and you are only using 3.5% as a down payment then the other .5% will be credited to you and will lower the amount you need to bring to the table for closing costs and escrows.
Again you will review the HUD-1 statement with the closing attorney and it will show you where all of your funds were applied. I hope this helps.
Good luck and congratulations,
Century 21 Beachside