There are already several answers still I would like to add another one to stress an aspect I feel did not get so much discussed in the other answers.
I would not consider answering and voting to close as some major etiquette violation, but I still think that in general it should be avoided. To summarize my position in one phrase:
Avoid answering and voting to close at the same time, when in doubt answer.
I would in particular like to stress the second part since I feel quite some of the discussion focused on: given I vote to close, can I still answer? and thereby somehow constructing a dichotomy between answering and not answering. But this is a bit a false premise. If a question is not that bad, and no one proposed answering really bad question, there is no urgency to close it. If it is a clear case, it will be closed regardless of the answerer voting, if it is not so clear and would depend on this one vote, then perhaps it should rather stay open anyway.
Now, why should one avoid it. I feel that the argument put forward by Alex B. is quite strong. The main purpose of closing a question is preventing additional answers (on this site at least). I feel this is hard to reconcile with adding an answer; perhaps sometimes it is possible but in general it seems mutually exclusive.
Several focused on the migration aspect, so one does not really want to prevent answers but one wants to move everything elsewhere. Yet, especially this scenario I my opinion should be avoided as commented. And this is not just my opinion but (semi) official SE guideline, form the meta.SE FAQ on migration
Avoid migrating answered questions. The point of migration is to send the question to an on-topic place when it can get answered. If the OP already has an answer, then we've already defeated the purpose of migration and the destination site won't have anything to do with the question. Avoid migrating these questions unless they are of extremely good quality and risk deletion on the current site.
Now, MO does often not follow SE guidelines closely, but migration is inter-network and thus I feel we should not take this quite clear guideline too lightly.
So, frowned upon on MO or not, at least voting to migrate and answering is (typically) in conflict with SE guidelines and thus should be avoided.
Additionally, it was brought up that the vote to close is to indicate that it is better suited for another site. Two points on this.
First a detail but somewhat relevant: that something is better suited for another site is no valid reason to close. A question most be not suitable for this site to vote to close it (leaving dupe votes and similar aside).
Second, a vote to close is not even a good way to indicate something. It is not very visible, at least not until it takes affect. And also as long as it did not take affect there is (normally) no way of knowing if an answerer voted to close or not. This is particularly relevant as normally I take somebody answering as indirect endorsement of the question (and I feel this is somewhat widespread and came up in discussion frequently, like 'look xyz answered, the question should be alright').
Thus if somebody wants to convey something else they better make this explicit, via a comment. This, for the purpose of indication, is also clearer, and might minimize the necessity to express it via a vote in addition. In brief, closing is not for indicating, but for enforcing.
I chose the formulation 'at the same time' to convey that if there is a relevant gap between the two acts so that the situation could have changed, this is a different situation.
Duplicates as usual could be a special case. And, also I can imagine other exceptions, but as a general guideline I would avoid doing both at the same time. Especially, as typically there is no compelling reason/relative inevitability for doing both.