The gates were closed at the sunset of the day before the Sabbath; since the Sabbath was regarded as commencing on the previous evening.
Related Commentaries of Nehemiah 13:19
Nehemiah 13:19
19 And it came to pass, that when the gates of Jerusalem began to be dark before the sabbath, I commanded that the gates should be shut, and charged that they should not be opened till after the sabbath: and some of my servants set I at the gates, that there should no burden be brought in on the sabbath day.