That plane was probably on autopilot once at cruising altitude. Thats probably when the pilot got up to go to the bathroom. Somebody locked the door. and from my understanding the settings for altitude have to be changed by someone.
I remember a few years ago a story about a flight where both pilots fell asleep and overflew their destination a few hundred miles. Autopilot maintained the altitude.
Old joke: A pilot and a dog. The pilot is there to feed the dog, and the dog is there to bite the pilot in case he tries to touch anything. It's closer to the truth than you might think.