On 24 August, Charles X Gustav joined Wittenberg's forces. The Polish king John II Casimir left Warsaw the same month to confront the Swedish army in the west, but after some skirmishes with the Swedish vanguard retreated southwards to Kraków. On 8 September Charles X Gustav occupied Warsaw, then turned south to confront the retreating Polish king. The kings met at the Battle of Żarnów on 16 September, which like the next encounter at the Battle of Wojnicz on 3 October was decided for Sweden. John II Casimir was exiled to Silesia while Kraków surrendered to Charles X Gustav on 19 October. On 20 October, a second treaty was ratified at Kėdainiai in the north. The Union of Kėdainiai unified Lithuania with Sweden, with Radziwiłł recognizing Charles X Gustav as Grand Duke of Lithuania. Over the following days, most of the Polish army surrendered to Sweden: on 26 October Koniecpolski surrendered with 5,385 men near Kraków, on 28 October Field Crown Hetman Stanisław Lanckoroński and Great Crown Hetman Stanisław "Rewera" Potocki surrendered with 10,000 men, and on 31 October the levy of Mazovia surrendered after the Battle of Nowy Dwór.. What event happened first, John II Casimir leaving Warsaw, or the levy of Mazovia surrendering?