It happened several times that wanted to answer a question on SO. I did some research, edited a text, corrected typing errors using Microsoft Word (my English not very good) and created a code example. But when a wanted to post it I could not, because the question had been closed or deleted meanwhile.
This is very frustrating!
Note: While working on the code example in VS or on the text in MS-Word one might overlook the banner indicating this situation.
My suggestion is that if the answer field was visible at the time that you opened a question, you should always be able to send your answer. The OP can still see the answer and possibly decide to undelete his question or users can decide to reopen the question if they find the answer valuable. In any case it would diminish the frustration.