Actually, for practical purposes they are sealed by a rubber diaphram which sits between the fluid and the cover. As the brake pads wear the fluid in the master cylinder reservoir is used, displacing the outward movement of the caliper pistons as they compensate for the pad wear. The diaphram deforms preventing air from entering the reservoir. Air can get in between the diaphram and the master cylinder cap but not under it unless it's torn or installed improperly.
Since brake fluid is hygroscopic, it actively absorbs moisture. I try to purchase only what I need to bleed the system. Any extra is thrown out if I'm going to store it for any length of time. Apparently this stuff can absorb moisture through the smallest openings.