Can I just close the hole after the raccoon leaves?

Not without checking the space. Other animals or dependent young may remain inside, and the opening may need a coordinated exclusion and repair plan.

Related help

Opossums · Squirrels and Chipmunks · Mammals and Marsupials

Pest Info · Find your service area

Further reading: New Jersey Fish and Wildlife.