From the Pennsylvania Historical and Museum Commission:
Once in office, he [Albert Gallatin] vigorously attacked the public debt, and through careful management of the country's finances he was able to reduce the debt materially until the War of 1812 made this policy impossible.
After 1811, it became increasingly unpleasant for him to remain as secretary of the treasury. It was with a feeling of great relief that in May, 1813, at the request of President Madison, he went to Russia to study the details of a Russian offer to mediate Anglo-American differences. He stayed in Russia several months, but nothing came of the Russian offer. In 1814, he was one of the five American commissioners who negotiated the Treaty of Ghent which ended the war. It was now that he was officially replaced as secretary of the treasury.