This question seems to suggest that it's common knowledge that it's not to be encouraged. However, if there is a simple (and usually really short) answer, should I not vote to close it and answer instead?
Is it OK to answer a question that you also vote to close?
Situations where this can be okay include
The question is hazy, and you think it should be closed in its current form, but you think you know exactly what the OP means
The question is borderline off-topic (like certain kinds of software recommendations), but it was asked in good faith, you can give a good answer anyway, and it's too big for a comment
The question is clearly flamebait, but you want to give a good, measured answer nevertheless
when doing this, always consider whether it's worth making your answer Community Wiki - seeing as the question's closing will deprive your fellow community members from adding their competing answers.
You answer because you want to help the person asking the question, you close because the question is not a good fit to the site. The two are separate decisions based on separate value sets: it's perfectly reasonable to do both.
But be aware that the points you might get for answering the question are in jeopardy, because the question might be closed and deleted based on your other action! I for one have done this at least once, answer a question and vote to close and add a comment explaining why I'm voting to close.
When voting to close (really migrate) as off-topic, belongs on another site, I think it's perfectly acceptable to also answer if you can. The answer will be appropriate even if moved. Under other circumstances I would probably comment, if anything, to help the user out. I'd rather not encourage users to ask bad questions, or repeat ones for that matter, by providing an answer. If the OP seems genuine in asking their question, they're more likely to get a helpful comment, but that's just me.