How can I change this light fixture in my closet?
If the old fixture worked, Then you should be good if all is connected properly. When you say you "wrapped" the new wires onto the wire in the ceiling, I take it you mean just that, and perhaps taped them up (given the first picture) - I'm guessing they came untaped and shorted out when you put the fixture in place.

Cut and strip the wires in the ceiling, and use a correctly sized wirenut or other suitable wiring connector to connect them to the fixture wires.