Exact results on decoherence and entanglement in a system of N driven atoms and a dissipative cavity mode