The question was closed. And closed either leads to being deleted or fixed in a way that makes the question in scope for the site topic and subsequently reopened.
Closed is not a synonym for no more answers, but that the question (if not otherwise a duplicate) doesn't belong on the site any more.
As to why the reputation on an answer to an out-of-scope/off-topic question disappears when deleted goes to when it happens.
First, if you've contributed something worthwhile to the site, you should keep the reputation for that even if it eventually gets deleted. "Worthwhile" here is defined as,
- A score of 3 or greater
- Visible on the site for at least 60
Since the question was deleted inside of 60 days instead of left to be deleted at 61, that is why the reputation goes with it.