All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Taking off the head cover does not nullify ablution. The uncovering of the head of a man/woman is not among the nullifiers of ablution. Ablution becomes invalidated only by eight matters which are as follows:
1) Excretions of the penis, vagina, or anus regardless of its quantity and kind. Allah Says (what means): {… or one of you comes from the place of relieving himself.} [Quran 4:43]
The Prophet said: “One should not leave (his prayer) unless he hears its (passing wind) sound or smells its scent.” [Al-Bukhari and Muslim]
2) Flowing of blood, pus and vomit if it is a large quantity according to the Hanafi and Hanbali Schools of jurisprudence; for the Hadeeth reported by Imams Ahmad and At-Tirmithi that the Prophet said: “Whoever is afflicted by vomit, nose bleeding, or Qals (a form of vomiting), or Madhi (prostatic fluid) should perform ablution.” [Ibn Maajah]
However, the preponderant opinion is that the above-mentioned matters in No. 2 do not break ablution.
3) Loss of consciousness regardless whether it was due to insanity, fainting, drunkenness, or deep sleep. The Prophet said: "The eye is the drawstring of the anus, so whoever sleeps should perform ablution."
However, if the sleep is not deep (the deepness should be estimated according to the customs of a people), such as sleeping while standing or sitting, then the ablution is invalidated. Anas narrated that, “the companions of the Prophet were waiting for the night prayer until their heads would nod, then they get up and perform the prayer without performing ablution.” [Muslim]
4) Touching the private parts with hand without any barriers, for the Hadeeth that the Prophet said: “Whoever touches his private parts should perform ablution.” [Ibn Majah]
5) Touching a woman or vice-versa with sexual desire for the Saying of Allah: {…or you have been in contact with women (by sexual relations) …} [Quran 4:43]
The preponderant opinion is that the mere touching of a man or a woman does not nullify one's ablution. The above verse refers to sexual intercourse, not any normal touch.
6) Eating camel's meat. Jaabir ibn Samurah said: “A man asked the Prophet : “Should I perform ablution after eating mutton?' He replied, 'If you wish' He then asked, 'Should I perform ablution after eating camel’s meat?' He replied, 'Yes.’” [Muslim]
7) Washing a dead person. Ibn 'Umar and Ibn ‘Abbas used to order the one who had washed a dead person to perform ablution. Abu Hurayrah said: “The least after that is performing ablution.”
8) Apostasy from Islam. Allah Says (what means): {And it was already revealed to you and to those before you that if you should associate [anything] with Allah, your work would surely become worthless, and you would surely be among the losers."} [Quran 39:65]
Allah knows best.