In Act 5 of Macbeth, Macbeth's remaining time as king has grown short, and he realizes that both his time as king and his life are coming to an end. However, even though Macbeth has this realization, he fails to make amends for his villainy and instead chooses to fight until the last moment.
First, Lady Macbeth has confessed her role in the murders, and she commits suicide because she feels guilty. But Macbeth says that there is no time to grieve over her death and feels that the approaching English army is more important than the death of his own wife.
Next, most of the Thanes who have been in Macbeth's charge have fled to join Malcolm and the English army. Macbeth knows that good kings have friends and loyal servants in their old age, but he realizes that now he is all alone. Again, Macbeth resolves to fight alone rather than make amends.
When Macbeth sees that Birnam wood is indeed "moving" toward Dunsinane, he does not respect the witches' warning and instead focuses on his own blinded interpretation of the third apparition which told him to fear one who is not of woman born. Macbeth's misinterpretation causes him to be arrogant when deciding to continue in this fight.
Finally, even after Macduff reveals that he was ripped from his mother's womb, Macbeth says that he will not fall on Malcolm's feet and he resolves to fight until the bitter end. This combination of ambition, greed, arrogance, and foolhardy willpower is the tragic flaw that leads Macbeth to his end.