I have just finished the wiring for a room in my house and was putting in the last few staples to hold the wire down. I didn't think to turn the power off while doing this. While pounding in a staple of a wire going into a switch box, the switch box threw a series of sparks and the power off of the switch went out. My question is, what exactly caused this to happen? My wiring in the switch box seems to be solid. Whites and neutrals twisted together tight and locked into pig tails. The wire ends to the switches are wrapped around solid. Could this have been caused by a small spark from when the hammer hitt the staple? The electrical switch wasn't screwed into the box so could it have bumped into the box by the shaking and returned via the neutral? Any theories? My main concern here is that I have done something wrong with the wiring. I have a permit and am having it inspected but would still like to be relatively certain I don't have a dangerous setup here.