A last-minute repair may have played a key role in the crash of a plane leaving Madrid International Airport.