If I keep the moss in a closed jar then how do I avoid molding?
Keep the lid off, or add spring tails (molding eating bug), or let the mold run its course.
Do I need to put soil in the jar?
No, moss will grow on anything really. It likes acidic soil, though I use peat moss myself and it works well.
What do to in winter?
It doesn't matter. Moss in the wild freezes in winter and when the rainy season comes again it'll spring back. It'll do fine at room temperature; just keep it moist and out of direct sun and should do fine.
Can the spores be contained if grown in a closed glass container?
I'm unsure about this, but I have two 10 gallon tanks with moss and a 40 gallon tank with just moss in it (used to house plants and frogs) and I'm fine, so I dont believe they cause any problems.