It varies wildly state by state. In the South and Mountain West, many states have the castle doctrine.
In the milder states, once the guy is leaving the house or non-threatening, you can't shoot. If you feel your life is in danger (and be sure to repeatedly state how scared you were in talks with the cops) you can shoot/stab but once the person is no longer a threat, you must stop.
Rare exceptions have been made for the elderly and disabled who successfully argued that they were afraid if they stopped the person would revive and the victim would lack the strength to defend themselves again.
I'm pretty conservative on this issue, but it's kind of common sense - if the bad guy is no longer a threat, stop attacking, no matter how pissed off you are.