The Zariski-Lefschetz principle for higher homotopy groups of nongeneric pencils