A black regiment of patriots from Massachusetts stormed the high ground at Yorktown and forced the surrender. They didn’t do it to preserve slavery.
Further...
A nation (England) that had slaves themselves at that time, were not here to end slavery.
We were not fighting to continue slavery.
https://en.wikipedia.org/wiki/Slavery_Abolition_Act_1833