Hellraiser

In Morocco, Frank Cotton buys a puzzle box from a dealer. In a bare attic, when Frank solves the puzzle, hooked chains emerge and tear him apart. Later, the room is filled with swinging chains and covered with the remnants of his body. A black-robed figure picks up the box and returns it to its original state, restoring the room to normal.
Some time afterward, Frank's brother Larry moves into the house to rebuild his strained relationship with his second wife, Julia, who had an affair with Frank shortly after their marriage. Larry's teenage daughter, Kirsty, has chosen not to live with them and moves into her own place. Larry cuts his hand carrying a bed up the stairs, and lets his blood drip on the attic floor. The blood resurrects Frank as a skinless corpse, who is soon found by Julia. Still obsessed with Frank, she agrees to harvest blood for him so that he can be fully restored, and they can run away together. Julia begins picking up men in bars and bringing them back to the house, where she murders them. Frank consumes their blood, regenerating his body. Frank explains to Julia that he had exhausted all sensory experiences and sought out the puzzle box, with the promise that it would open a portal to a realm of new carnal pleasures. When solved, the "Cenobites" came to subject him to the extremes of sadomasochism.
Kirsty spies Julia bringing men to the house; believing her to be having an affair, she follows her to the attic, where she interrupts Frank's latest feeding. Frank attacks her, but Kirsty throws the puzzle box out the window, creating a distraction and allowing her to escape. Kirsty retrieves the box and flees, but collapses shortly thereafter. Awakening in a hospital, Kirsty solves the box, summoning the Cenobites and a two-headed monster, which Kirsty narrowly escapes from. The Cenobites' leader, Pinhead, explains that although the Cenobites have been perceived as both angels and demons, they are simply "explorers" from another dimension seeking carnal experiences, and they can no longer differentiate between pain and pleasure. Although they attempt to force Kirsty to return to their realm with them, she informs Pinhead that Frank has escaped. The Cenobites agree to take Frank back and, in exchange, say they will consider giving Kirsty her freedom.
Kirsty returns home, where Frank has killed Larry and taken his identity by stealing his skin. Julia shows her what is purported to be Frank's flayed corpse in the attic, locking the door behind her. The Cenobites appear and demand the man who "did this". Kirsty tries to escape but is held by Julia and Frank. Frank reveals his true identity to Kirsty and, when his sexual advances are rejected, he decides to kill her to complete his rejuvenation. He accidentally stabs Julia instead and drinks her blood without remorse. Frank chases Kirsty to the attic and, when he is about to kill her, the Cenobites appear. Now sure he is the one they are looking for, they ensnare him with chains and tear him to pieces. They then attempt to abduct Kirsty. Ripping the puzzle box from Julia's dead hands, Kirsty defeats the Cenobites by reversing the motions needed to open the puzzle box, sending them back to Hell. Kirsty's boyfriend shows up and helps her escape the collapsing house.
Afterwards, Kirsty throws the puzzle box onto a burning pyre. A creepy vagrant who has been stalking Kirsty walks into the fire and retrieves the box before transforming into a winged creature and flying away. The box ends up in the hands of the merchant who sold it to Frank, offering it to another prospective customer.

Question: how did kirsty defeat the cenobites?