A lot of states would arrest the homeowner here. The general rule is the bad guy must be in your home and you must have legitimate fear of personal harm to you or your family.
If a thief is walking out of your home with a TV set, you cannot shoot him in the back.
Not true in PA, it can be in the mall, at the gas station or on the golf course.
The castle doctrine extends to where ever you are, and you can protect your life and property.
If someone is in my home, trying to steal a $10 radio, I'm in fear for my life and his life span is going to be dramatically shortened.
My life was threatened by the mere presence of a perp.
If the criminals put him in fear for his life once he went outside to inquire why they were attempting to break into his home instead of going straight to their own homes, then the shooting was legal. If they were attempting to break in and did not immediately turn and flee, then I applaud the decision to shoot. The only reason not to run at once is because the criminals were considering attacking the law-abiding homeowner.
More accurately, a lot of local District Attorney's in many states would press charges, even if a state has a Castle law and/or stand your ground law. Most states have a Castle law and a growing number have stand your ground laws. It doesn't mean liberal DA's won't make your life a living hell for defending your property or life.