You're talking about "Locking" a topic - that prevents someone from replying to it. However, currently, there's no mechanism for automating locking on the basis of date of last post in a topic, which is what you seem to be asking for.
All you can do is lock a topic manually and individually.
Other options to prevent posting include moving such topics into an "Archive" sub-forum from which you remove the "Reply" permission, or to one that is only visible to registered users. That would prevent a search engine reading it, so old topics would eventually get lost from their search results. However, these options still require that you decide which topics reach the "expired" criteria and that you take the action manually.
On the other hand, if you're a wizard at writing NAML code... (I'm not!)
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.