Headset bearings open to closed type My XC MTB has open type headset bearings, is it possible to replace them with closed type?

The main problem is that I live in a flat and only place where to wash my bike after a muddy or dusty race is self-service car wash nearby. that results in sands being pushed into headset bearings and I have to clean them basically each time I wash my bicycle.
You will very likely be able to buy a new, sealed bearing headset for your bike. Without more information I can't tell you any more than that. It's not a particularly difficult job for a bike shop, but it can be tricky if you don't have the right tools.

Also, as pointed out in the comments, "sealed bearings" are better at resisting water and muck, but they're not waterproof and definitely not water-jet-proof.