Can you undo close all Finder windows (alt + click the red close button)?
This functionality is not available natively in Finder, but it can be gained by the use of third party software such as XtraFinder and perhaps Default Folder X. Please note though that you would have to check compatibility as you don't specify what version of macOS you're using.

Another option that may interest you is to access your recent folders. To do this:


Ensure you have Finder active
Click on the Go menu
Hover over the Recent Folders sub-menu
You'll now see your most recently opened folders
Select the folders one by one to reopen them


Notes: 


This is not an undo option, but at least you can easily reopen most of your Finder windows (although not likely as many as 20 of them).
I have no affiliation whatsoever with either XtraFinder or Default Folder X.