During the night of July 4-5, Lee's battered army began its retreat from Gettysburg, moving southwest on the Fairfield Road toward Hagerstown and Williamsport, screened by Stuart's cavalry. The Union infantry followed cautiously the next day, converging on Middletown, Maryland. On July 7, Imboden (CS) stopped Buford's Union cavalry from occupying Williamsport and destroying Confederate trains. Kilpatrick's cavalry division drove two Confederate cavalry brigades through Hagerstown before being forced to retire by the arrival of the rest of Stuart's command. Lee's infantry reached the rain-swollen Potomac River but could not cross, the pontoon bridge having been destroyed by a cavalry raid. On July 11, Lee entrenched a line, protecting the river crossings at Williamsport and waited for Meade's army to advance. July 12, Meade reached the vicinity and probed the Confederate line. July 13, skirmishing was heavy along the lines as Meade positioned his forces for an attack. In the meantime, the river fell enough to allow the construction of a new bridge, and Lee's army began crossing the river after dark on the 13th. On the morning of the 14th, Kilpatrick's and Buford's cavalry divisions attacked the rearguard division of Henry Heth still on the north bank, taking more than 500 prisoners. Confederate Brig. Gen. James Pettigrew was mortally wounded in the fight. On July 16, David McM. Gregg's cavalry approached Shepherdstown where Fitzhugh Lee's and J.R. Chambliss's brigades, supported by M.J. Ferguson's, held the Potomac River fords against the Union infantry. Fitzhugh Lee and Chambliss attacked Gregg, who held out against several attacks and sorties, fighting sporadically until nightfall when he withdrew.