Optical switching in arrays of quantum dots with dipole-dipole interactions