The entity has alternating Lock and Unlock buttons in the GUI, which can be used to force its gate open or closed (unlocked gates stay open if a player entity is adjacent, but close to deny entry to the enemy).

Gates are the weak point in a wall. They are more susceptible to crush attack. Not only do they allow your units to exit, they are possible points of entry by the enemy.