If they were loaded at the top of the stacks, the semi-auto twistlocks would have locked as soon as they were loaded. Prior to discharge though, all the twist locks are unlocked so the cranes can lift them off.
Also, the boxes on top may be close to empty with lighter cargo for stability purposes. Either way, I’ve never seen containers blow off of a ship at the berth. Wild stuff.