when they had played for a while , the bear went back out of the cave , but before she left she rolled a huge stone over the opening , so that our little hans was locked behind the gate and door , since she preferred to have him back inside .