Apparently that design of aircraft has three positions for the cockpit door to be in: unlocked, normal, and locked. Most of the time the door remains in 'normal'; allowing a pilot or other authorized crew member to access the cockpit with a security card/code. It appears the door was only switched to 'locked' after the senior pilot left the cockpit; making it extremely likely it was a mass murder/suicide.
It must have been absolutely terrifying for the passengers and crew descending those last few minutes with the clear weather allowing them to see the incoming mountains while the senior pilot frantically tried to break into the cockpit. Utterly terrifying.