As with many programming problems, the easy way to do things is to crib from someone who already did it.
Caveat: The following is tied to the Mathematics StackExchange site, basically because it's a good size but not gargantuan like StackOverflow. Each SE site has its own query interface, so you'll need to pick one to run a query against (rather than all sites at once).
You'll probably want to create a login account for the StackExchange Data Explorer. By design you can preserve some extra anonymity by creating an account name there which is unrelated to other site activities, though I did not feel motivated to do so.
I looked through search results for queries containing "close" and found this one:
obtain all closed questions
WHERE CLOSEDDATE IS NOT NULL
Probably you really intend to do something more refined, perhaps in the way of a range of dates posted (or closed). Post a follow-up comment if you'd like a bit more of a tutorial. The link in the caption above let's you Run Query, and there are a couple of optional settings to play with.