I dont think so unless the jar was in the bed with you , tell the doctor anout your head pain and go see one as soon as you can.
Just being around mold can cause lots of symptoms. I hope you cleaned the bottom of the closet well - in case some of the mold spores got on the floor. Wear a mask when you clean and use a good deal of clorox to kill the mold. For yourself, take Milk Thistle and a liver detox. This should help you get over the mold sickness. (Do not mix clorox and ammonia as they cause burned lungs and gas fumes!)