Once ready, the cockpit doors are usually kept closed for the flight's duration. There are only a few situations in which the cockpit door is opened during a flight. One is when pilots change shifts on a long-haul flight or while one goes to the bathroom mid-flight.