From the Admin wrench within a topic you can “Make Unlisted”.
That could be done via the API too, without breaking categorization.
You might consider having that happen 24+ hours after the topic is closed, so there is some transparency about the fact that a topic was closed before it becomes invisible.
Perhaps a category setting to “unlist closed topics after N hours” would be a worth considering…
