Ending a war is a good thing. Killing civilians a bad thing.
Deliberately targeting civilians is murder, and is never morally licit, even in pursuit of a good thing such as ending a war.
The tens of thousands of Japanese non-combatants we killed 68 years ago this week with two nuclear bombs were not “collateral damage” of military strikes. They were the intended targets.