Old western saloon doors have spaces under them, which means people can still crawl under them and get in even if the doors are locked. How did the saloon owners lock up at night to keep people from breaking in?
Most saloons didn't have those butterfly doors. Those that did had proper outer doors.
...the butterfly doors and the orientation of the bar, essential elements of movies and television, had little to do with the reality of most western saloons. In fact, outside the desert Southwest, butterfly doors would have been an environmental impossibility. During the summer they would have allowed the wind and dust to come in, and during the winter they would have made a saloon impossible to heat. Virginia City saloon entrances were almost always guarded by narrow, twin doors, often ten or twelve feet high, with panels of glass to allow in as much natural light as possible.
In addition, a Mental Floss article notes that even the butterfly doors were ornamental.
But for the saloons that had them, the café doors were actually a secondary barrier; the buildings were traditionally equipped with a standard set of solid doors on the outermost part of the entrance. When opened they laid flat against each side of the building during business hours, but they could be shut (and padlocked when necessary) during bouts of inclement weather, or when the building was unattended. While many mines in places like Virginia City, Nevada stayed open 24 hours, newspapers from the time allude to the fact that the saloons did in fact close in the early morning hours, making the locks necessary.