The Confederate generals surrendered because they realized that, with Lee himself surrendering, they had zero chance of prevailing, and any continuation of hostilities would result in the North invading the Confederate states and shooting/hanging not just the generals themselves, but all the civilian leaders who supported them. It wasn't to "keep the country from endless guerilla warfare", but rather an act of simple self-preservation.
While there was a fair amount of war wariness among the public, continued resistance by the Confederacy was not something the North would have tolerated, especially since they clearly had the upper hand at that point.
While there was a fair amount of war wariness among the public, continued resistance by the Confederacy was not something the North would have tolerated, especially since they clearly had the upper hand at that point.