Similar to Warn answerers on close candidates I think that answering bad questions isn't really helping the site. While that feature-request is mostly about warning users that are about to answer (and mostly targeting duplicate questions) there are also cases where the question is answered before even the first close vote.
I therefore propose we add a feature that people who answered a question that got closed, get notified about it. Depending on the close reason, the notification can ask for possible actions.
closed as duplicate
Look at the duplicate and decide if you want to move your answer there, or if it is already present at the duplicate and you want to delete it here
closed as unclear
It seems you have understood the question, but a lot of other people did not. Please take some time and edit the question so that it will be clearer for future visitors how your answer answers it.
others
Explain a bit about the reason why it was closed and motivate to improve the question if possible, or revoke the answer.