Is it a good idea to close escrow while there is a tenant in the property that is currently being evicted?

Assuming you are the buyer, the answer is yes and no. Eviction can cost you a bit for an attorney, but you could also use the presumably "bad" tenant in possession as a bargaining issue to get a better price, one which might more than offset the trouble and expense of bidding Mr. Malatenant a fond adieu.

It might pay to do some homework though. Is Mr. Malatenant a "professional tenant" (one who makes a habit of sponging all landlords and then moving on to the next)? Does he have a criminal record? What do the neighbors say about him? Police get called a lot? These are important because you'd want to know if he's the type to trash the place on the day he gets booted. Or he might be a decent person who just lost his job.

If possible, request the seller to complete the eviction before the close of escrow. Also, consider requesting the seller to have the tenant sign and "estoppel certificate" clarifying the status and claims against the seller. Finally, ask the seller to "indemnity" you against any costs and damages claimed by the tenant in the course of the eviction lawsuit.