You write a plugin that checks the database for questions older than x, called one time per day (preferrable by an event that happens by a logged in user).
Then you retrieve the list of questions and you use this function to close them:
function qa_post_set_closed($questionid, $closed=true, $originalpostid=null, $note=null, $byuserid=null)
/*
Closed $questionid if $closed is true, otherwise reopen it. If $closed is true, pass either the $originalpostid of
the question that it is a duplicate of, or a $note to explain why it's closed. Pass the identify of the user in
$byuserid (or null for an anonymous change).
*/