Vanilla Sky

From a prison cell where he has been charged for murder, David Aames (Tom Cruise), in a prosthetic mask, tells his life story to court psychologist, Dr. Curtis McCabe (Kurt Russell).
In flashback, David is shown to be the wealthy owner of a large publishing firm in New York City which he inherited from his father, leaving its regular duties to his father's trusted associates. As David enjoys the bachelor lifestyle, he is introduced to Sofia Serrano (PenÃ©lope Cruz) by his best friend, author Brian Shelby (Jason Lee) at a party. David and Sofia spend a night together talking and fall in love. When David's former lover, Julianna "Julie" Gianni (Cameron Diaz), hears of Sofia, she attempts to kill herself and David in a car crash. Julie dies but David survives, his face grotesquely disfigured,[4] leading him to wear a mask to hide the injuries. With no hope to use plastic surgery to repair the damage, David cannot come to grips with the idea of wearing the mask for the rest of his life. On a night out with Sofia and Brian, David gets hopelessly drunk and Sofia and Brian leave David to wallow in the street outside.
David is awakened the next day in the street by Sofia, who apologises for deserting him the night before, and takes him home. The two continue to see each other, and David has his face surgically repaired despite being told it was impossible before. Though his life seems perfectly content, David finds oddities, such as brief visions of his distorted face, and a man (Noah Taylor) at a bar that tells him David can control the world and everyone in it, if he wanted to. One day, when he goes to Sofia's apartment, he finds Julie there instead; all of the previous mementos of Sofia now show Julie's face. Angry and confused, David suffocates Julie, and is later arrested and placed in a mental institution, finding his face has reverted to its previously disfigured state.
David completes telling his story to Curtis, who proceeds to then visit David further for more sessions to try to help him recuperate. During one interview Curtis tells David the staff reported him calling out "Ellie" in a bad dream and asks who she is. David later sees a nearby TV advertisement for "Life Extension", a company that specializes in cryonic suspension, and realises he'd actually called out "L","E". Under Curtis' and a police officer's guard, David is taken to the Life Extension offices, where the salesclerk Rebecca (Tilda Swinton) explains they freeze people just after the point of death, until a cure for their ailment is available in the future, keeping their brain active by placing them in a lucid dream state. David becomes anxious and breaks free of Curtis, realizing he is in his own lucid dream that has gone wrong, and calls for tech support.
David finds himself in the empty lobby of the offices, and the man whom he saw earlier at the bar appears, claiming to be David's tech support from Life Extension, which is now known as the Oasis Project. They ride up in an elevator to the top of an impossibly tall building, the height triggering David's severe acrophobia. The man explains that David has been in cryonic sleep for 150 years. David had opted for Life Extension's services after struggling with his breakup with Sofia and his disfigurement, and after securing the publishing company to its associates, proceeded to kill himself with a drug overdose; Life Extension preserved his body and, as David directed, put him into his lucid dream starting from the drunken night when Sofia left him, under the "vanilla sky" from a Monet painting. However, during his sleep, the dream went horribly wrong and attempted to incorporate elements from his subconscious, such as substituting Julie for Sofia and creating a father-figure in Curtis. As they arrive at the top of the building, the man offers David a choice: either to be reinserted into the corrected lucid dream, or return to the real world by taking a literal leap of faith off the roof that will wake him from his sleep. David decides to wake up, ignoring the vision of Curtis that his subconscious has brought to life to talk him out of it. David envisions Sofia and Brian to say his goodbyes. Conquering his final fear, David jumps off the building, his life flashing before his eyes, and whites out immediately before hitting the ground. A female voice commands him to "open your eyes" (a recurring theme in the movie), and the film ends with David opening his eyes.
Alternate ending version[edit]
The 2015 Blu-ray release offers the option to watch the film with an alternate ending. This alternate ending expands greatly upon the details at the end of the film. While it all leads to the same conclusion, there are additional scenes, alternate takes, and alternate dialogue.
After Rebecca describes the lucid dream, David rushes out of the room but does not immediately dash towards the elevator. He meets McCabe in the restroom who tries to convince him that this is all a hoax and a con and that his case is going to trial. David tells him that he's only in his imagination. Much like in the theatrical cut, the Beach Boys' "Good Vibrations" plays, but this version makes it clear that David hears the music and that he chose it; meanwhile McCabe tries to convince him there is no music.
At this point, David dashes out of the restroom for the elevator the way he does in the theatrical cut, but the scene in the lobby is expanded â David shoots the police officer who is firing at him and is then surrounded by a SWAT Team whom McCabe tries to talk down, but the SWAT Team fires at both of them. They black out and wake up in the emptied lobby where McCabe continues to applaud what he believes is a performance while David gets into the elevator with Ventura and tells him what happened at the end of his real life.
Once they reach the roof, McCabe re-enters again and his pleas to David not to believe Ventura become more and more desperate until he collapses onto the ground in despair. David's interaction with Sofia is extended as he tells her he loves her but can't settle for a dream. He then jumps off the building and screams that he wants to wake up as images from his life flash before his eyes. He wakes up in bed and a voice tells him "Open your eyes. You're going to be fine."

Question: Who apologized for deserting David?
Answer: Sofia