I think that someone helped the nifflers get in the common room. When the common room is empty, someone opens the door and lays a trail of shiny items along the way. As nifflers love shiny stuff, they will follow the trail, and end up in the common room that way. There are also shiny items scattered throughout the common room so that the nifflers will be busy for a while and not leave. When all the nifflers are inside, the person will sneak outside and close the door, locking the nifflers inside.