The reason for closing the gallery at three o'clock goes back many years before I arrived in my role inside the Chamber, and it was a cost-saving measure implemented by the Sergeant-at-Arms at the time. Shutting it at three reduces the requirement for guards in the north gallery, and also reduces the requirement for scanners.
On April 24th, 2018. See this statement in context.