From Meta:
We give people a server side grace period to answer questions, even if the question gets closed.
If the client side checks fail, for whatever reason, and someone does post an answer, we will accept it (for a while).
and:
If a question is closed while you're answering on the full version of the site, you will receive a notification that the question was closed and the 'Post Your Answer' button will be disabled. However, this is only a client-side restriction, so it is possible in some cases that this process fails.
When it does, the backend allows for a grace period of around four hours (previously there was no time limit). Presumably the client-side restriction did fail in this case, and since the answer was "in-flight", as Jeff describes it, the server accepted it despite the question already having been closed.
For users answering from a mobile device, there's no client-side restriction in place to begin with, so this situation is presumably even easier to create when using the mobile version of the site.
As a side note, this apparently even works for questions closed due to migration.