Praise be to Allah.
A written divorce counts as such so long as there is the intention to divorce. So if a man writes words of divorce but does not intend it as such – rather he intends to alarm and scare his wife – it does not count as such. See the answer to question no. 72291.
To sum up, in the event of extreme anger in which a man does not know what he is saying, divorce does not count as such. The same applies to extreme anger that prompts and compels a man to utter words of divorce, even if he is aware of what he is saying.
As for mild anger which does not have an impact on a man’s will such that it compels him to utter words of divorce, in this case the divorce does count as such.
If he issues three or two divorces in one go, then it counts as one talaaq according to the more correct scholarly view.
It seems from your question that the last divorce did not count as such.
As for the divorce that came before it, then according to the details mentioned, if the anger that accompanied it was extreme, as we have described, then that divorce also does not count as such, but if the anger was mild, then it counts as one talaaq.
What you must do is fear Allah, may He be exalted, and restrain your tongue and avoid uttering words of divorce when you are angry, because divorce was not prescribed for this, and you are exposing your household to destruction and ruin.
And Allah knows best.