At least in theory, closed off-topic questions serve as a signpost for future posters and show what questions aren't accepted. There are sometimes comments on those questions that add further detail into why the question was closed.
Similar questions asked in the future can be closed as duplicates of the original as well.
I believe eventually closed questions get purged, but I'm not entirely sure on when that happens and whether it's an automated process.
Edit: the question can also be re-opened if 5 people (or a moderator) think it was closed for the wrong reasons. Reopening the question is easier than undeleting, as more people have access to a closed question than to a deleted one. While I agree that questions that are clearly off-topic should be removed, I don't think such removal can be reliably done automatically without deleting questions that can be edited (if needed) and reopened.