How close was the civil war?

The Confederate objectives for the war were to either prolong the conflict to the point that the Union got tired of fighting or have Britain or France intervene on their behalf. The first is hard to measure, but it may have been possible before the battle of Antietam in 1962. Lee's failed invasion of the North galvanized the Union and made abolishing slavery a clear objective of the war's end. Of course there was still dissent with the Union leadership and the war in general, but Antietam gave the war a better sense of purpose.

Foreign intervention may have been the CSA's best bet. By relying on their dominance in the cotton trade, the Confederates hoped to force Great Britain and France to provide military or diplomatic support. Napoleon III was pretty openly supportive of the Confederacy, but was hesitant to provide help without British consent. In Britain, the debate was much more heated. On one hand, they relied heavily on Southern cotton for textile production, but on the other, many did not want to fight a war to defend slavery- which the war increasingly became. Additionally, losing the United States as an ally was a major concern for Britain.

One high point for European support of the CSA was after their victory at Seven Pines, which decisively pushed the Federal forces away from Richmond. Parliament debated the matter, but the Prime Minister ultimately decided to wait for more victories before intervention. As it turned out, not enough decisive victories came through for the CSA, and intervention never happened on a meaningful scale. One notable exception was the construction of ships for the Confederate navy, one of which was the famed CSS Alabama, a screw sloop that destroyed the New England whaling fleet and generally caused havoc for the Union until she was sunk by the USS Kearsarge off of Cherbourg in 1864.

Sources:

McPherson's "Antietam" Sven Beckert's "Empire of Cotton" is also a great resource for the war's impact on the cotton industry.

/r/AskHistorians Thread