When Caleb first enters Nathan's facility/home, he learns that in the event of a power failure all the doors will lock.
Caleb changes the code while Nathan is drunk (on the eve of Ava's escape) so that the doors will open during a power failure, instead of locking down. When Ava leaves, it appears at first that she leaves Caleb trapped in Nathan's room. But soon after, we see Caleb try to access the computer and then a power failure occurs.
So
At that point, can't Caleb simply walk out of the room because all the doors are now unlocked?