What should I do with the wires before I put a cap over the hole left by my (broken) electric smoke alarm?
Stuff the wires in the hole and put a round blank cover over it
Hardwired smoke alarms, like your old ones, are required to be mounted to mains wiring junction boxes since they run directly off mains electricity, and all splices of or connections to mains electrical wiring in North American need to be made in a junction box.  As a result of this, what you're seeing here is that junction box, and junction boxes can't be left open/uncovered, so you need to put a blank cover of the appropriate shape (a 4&quot; round cover should do the trick) on the box the smoke alarm was mounted to.