Beat me to it.
Japan did not surrender after Hiroshima. They were willing to carry on fighting.
After Nagasaki, they changed their mind.
The bombs were necessary — and they saved a million lives. Mostly they saved Japanese lives. The invasion of the home islands was going to be awful for everyone.
Precisely
“After Nagasaki, they changed their mind.”
The timing might suggest it, but also the Russians were bearing down on Japan and that scared the Hell out of them.