On the connectedness of degeneracy loci and special divisors