Here's how a canal lock works going downstream:
 

Step 1:
The barge enters the lock and the upstream gates are closed

Step 2:
The downstream sluice gates open, letting water out of the lock and lowering the barge

Step 3:
When the water reaches the level of the downstream side, the downstream lock gates open, and the barge moves on downstream