Lets see, it's been a while.
For NY state, but not NYC, buyer pays 10% down once offer has been accepted - money handled by sellers attorney trust.
Both sides use real estate attorneys. Each sales contract is prepared from scratch. One attorney provides closing location. Once final price is agreed on the attorneys calculate credits (inspection outcome and property tax) and allocate the proceeds to title company, sellers mortgage, real estate agents fees, attorneys fees, other fees (lots) , and if anything is left over, seller. In westchester and NYC, title insurance agent expects a tip to be paid by seller at closing. NY State has a mansion tax - 1% for property over $1M if used for residence, paid by buyer. NY State has real estate transfer tax of 0.4% ($4 per thousand) paid by seller.
NYC has additional fees and taxes.
If buyer is paying cash, individual checks are written to sellers mortgage, sellers attorney trust and both real estate agents. If buyer has mortgage, mortgage company decides who it will write checks to, works out details with attorney(s), then proceeds. In either case, how cash is handled is determined by the attorneys and mortgage companies. Trusts and bank checks are used.
A good real estate attorney is a must.