Either the pilot in the cockpit suffered a heart attack or some other disabling physical impairment where he was unconscious and could not let the other pilot back into the cockpit...
That can be ruled out in this case - the cockpit door is designed to open with a keypad from the outside after 30 seconds, unless someone inside the cockpit actively switches the automatic opening off within that time. Unconscious people don't push switches.