Spectrum of a large N gauge theory near the transition from confinement to screening