The most simplified, and basic answer, is that they are a notary. The notary is there to verify everyone's identity and to witness everyone's signatures. They'll go through all of the documents, witness the signing, and then place their seal or stamp on the paperwork which then lets the lender know that the notary, or closer, verifies that they were present to witness everything.
A notary is required to prevent lenders, title companies, and any other party of the transaction from committing fraud by signing someone's name on their behalf. There are certain forms of identity that the closer will need from you to verify everything before the closing can take place. You can read about those forms here.