Right after it finishes flowering. Forsythia, like other spring flowering shrubs, set their buds during the summer after the flowering period. Those latent buds (you don’t really notice them) winter over on the plant so they are ready to going spring. pruning in late summer won’t hurt the forsythia but you’ll be removing the buds for then next spring’s show of flowers.