You can use a special template if you need to close old issues.
When you select a template then it starts new automation with a filled-in answer for the automation name, trigger, condition, and action that accomplishes a specific use case. You'll see the "JQL Condition" value in the"Jira Query Language" field. The trigger is " Schedule of issue" and the action is "Close issue".
Enter the automation name and select the project. Don't forget to enable your automation.
When trigger and condition will fire then action will happen on the board.
Try the Automation Unlimited for Jira for free on the Atlassian Marketplace.