You should take every precaution to protect your interests and as others have mentioned DO NOT go to closing with anyone occupying the property. To do so would be to assume a huge risk and additional responsibility.
Your agent should make your concerns clear to the listing agent....
It might be a good idea to document all of this...have your Realtor contact the listing agent and ask for a written statement about when the 'friend' will be out.
If yes, demand to see it. If no, then call the sheriff for illegal trespass. Let them know they can be prosecuted for illegal trespass.