Personally I am more worried about DMS than contamination during cooling so I keep the lid off. If you've ever gotten that DMS nasty off flavor you would be too.
With all due respect, you have just as much if not more concern about DMS during cooling. With the lid on the condensate from the lid will recycle back to the wort and quite possibly cause the DMS issue which comes across as cooked corn flavor in he finished beer.
The vapors drifting off of the cooling wort will also provide an adequate barrier to airborne pathogens for the short period of cooling.
From what I understand, when you are cooling, the concern is not trying to continue to release the DMS by leaving the lid off, but instead trying to cool the wort as quickly as possible.
If the wort continues to sit at a near boiling temperature, DMS continues to form. If you don't cool the wort quickly, you will get DMS and the corn flavors associated with it in the beer in the finished beer.
From John Palmer "How to Brew":
How to Brew - By John Palmer - Common Off-Flavors
Dimethyl Sulfides (DMS)/ Cooked Vegetable Flavors
Like diacetyl in ales, DMS is common in many light lagers and is considered to be part of the character. DMS is produced in the wort during the boil by the reduction of another compound, S-methyl-methionine (SMM), which is itself produced during malting. When a malt is roasted or toasted, the SMM is reduced beforehand and does not manifest as DMS in the wort, which explains why it is more prevalent in pale lagers. In other styles, DMS is a common off-flavor, and can be caused by poor brewing practices or bacterial infections.
DMS is continuously produced in the wort while it is hot and is usually removed by vaporization during the boil. If the wort is cooled slowly these compounds will not be removed from the wort and will dissolve back in. Thus it is important to not completely cover the brewpot during the boil or allow condensate to drip back into the pot from the lid. The wort should also be cooled quickly after the boil, either by immersing in an ice bath or using a wort chiller.
I would rather cover the wort, to prevent any infections as much as possible, and cool it at the same time using an immersion chiller. That allows me to avoid both the infection issue and the DMS issue.