The first half of Marijo's answer was excellent, but it's fine to use "achieving" here.
In all of Marijo's examples, "to" is showing the idea of "direction". It isn't being used to make a verb infinitive. The "-ing" is turning the verb into a gerund, and gerunds act like nouns.
****SO, if you can put a noun after the "to", you can put a gerund there, too.***
I am getting used to *the weather* (noun)--> I am getting used to *exercising* frequently. (gerund)
I am partial to *cake* (noun) [I am partial to X= I like X]--> I am partial to *swimming*. (gerund)
Bob is a disgrace to *his family* (noun)-->Bob is a disgrace to *teaching*. (gerund)
And, in your example:
We are getting closer to *New York* (noun)--> We are getting closer to *winning* the war. (gerund)