The fact is, in most cases what is obvious to someone is not to another person.
Take this question as en example. ChrisF commented that the question is off-topic. Is it? Well, as it was at the beginning and with php tag, it strongly feels as Stack Overflow or Webmasters.SE related question, which has nothing to do with programming in general. Remove the tag, slightly reformulate the question, and it doesn't seem off-topic any longer (even if I would rather say it belongs more to Webmasters.SE).
If the question was "How to set different languages for different crawlers in PHP?", then yes, it would be a Stack Overflow question. As is, it's not the best candidate to be closed as off-topic.
Even in much more obvious situations, there are still a few reasons to answer anywhere:
Imagine the question belongs to Stack Overflow, and it will be migrated, for sure. I have an account on both Stack Overflow and here. Do I really need to wait until the question is migrated, then search for it on SO, and then answer? It's much easier to answer now and, at the same time, to vote to migrate. For the community, it doesn't change anything, except that the question is answered earlier.
I don't answer for reputation. I answer:
- To help people,
- Because I like answering questions related to general programming,
- Because some of my answers might be useful for community.
It means that there is no reason to not answering a question before it's closed: the answer helps the OP, I enjoy writing the answer (well, I don't enjoy receiving "The answer is closed" notification while writing the answer for the last ten minutes) and the community may still read the question and the answer, since closed questions remain accessible by every user, unless deleted.
If you answer just to get rep, then yes, you may want to avoid doing it on a question which will be closed.
If there is a good answer to a closed question:
- It will bring people to Programmers.SE when they search for the same subject on Google,
- It will be useful if somebody wants to post a similar question: not only he'll know it's not constructive, too localized or whatsoever, but his question will be already answered.
What will hurt, is:
If people would answer to the old low-quality questions, making them appear on the home page.
If the sole purpose of answering a question which will be closed would be to gain reputation.
The first point may be a problem, but from what I've seen, the low-quality questions are closed quickly enough for that. The second point is a non-issue, IMO. Most users who post low quality questions rarely accept or upvote answers, and other people won't upvote your answer just because you made an effort answering a closed question: they upvote if your answer is good; if it's good, it's welcome on SE websites.