Islamic State’s loss of al-Bab after weeks of bitter street fighting marks the group’s effective departure from northwest Syria, once one of its most fearsome strongholds, and an area of importance because of its location on the Turkish border.