Abandon

Senior college student Katie Burke (Holmes) is struggling to deal with the stress of completing her thesis and succeeding in an upcoming rigorous interview process. To make matters even more complicated, Detective Wade Handler (Bratt), a recovering alcoholic, reopens the two-year-old police investigation into the disappearance of her boyfriend, Embry Larkin (Hunnam). An orphaned young man of considerable means, Embry had purchased two tickets for Crete before his disappearance; the tickets had never been used and Embry's financial assets had not been touched since his disappearance. With the official reopening of the Larkin case, however, Katie begins to see Embry lurking around campus, seemingly stalking her.
Reporting this back to Detective Handler, who dismisses her as he believes Embry to be dead, Katie isn't convinced but nevertheless returns to school. Falling asleep in the college library while studying, upon waking she finds a number carved into the wood of the desk. Upon investigation, she discovers it references a library book: The Inferno. There she finds Embry staring back at her from the other side of the book stack.
Confiding these troubling events to her friends, most notably her roommate Samantha (Deschanel), Katie learns that during her relationship with Embry, he had acted extremely jealous and even violent toward another of Katie's admirers, Harrison (Mann), whom Katie held only platonic feelings. Shortly thereafter, Harrison seemingly disappears from campus. Convinced that Embry is responsible, Katie confronts him at a local restaurant, only to be asked to meet him at his family's country house.
Once at the Larkin family's country house, however, a violent confrontation ensues between Katie and Embry. Fleeing from the house and finding comfort in Handler, Katie begins an affair with the detective which spurs her to complete her thesis. With Handler closing the investigation, citing that Embry Larkin was indeed alive, and resigning from his job as a detective, he and Katie plan on temporarily retreating to Handler's cabin in New Hampshire. Meanwhile, however, Handler learns from a forensic expert that a note which had supposedly only recently been written by Embry to Katie was, in fact, two years old.
Waiting for Handler on campus, Katie is once again attacked by Embry, who promises to find her wherever she goes before running off. Informing Handler of her encounter with Embry, Katie asks him if the two of them can just leave, but Handler insists on putting a stop to Embry's threats. Following Katie's direction to where Embry ran off, Handler and Katie venture into Embry's former dormitory, which is now abandoned due to the building's derelict structure. As they walk into one of the building's old tunnels, a former spot for Katie and Embry's trysts, Katie begins to interact with Embry, but Handler sees no one.
Through flashbacks, it is revealed that Katie and Embry had been in the same location two years prior, with Embry cruelly breaking up with her and calling off their planned trip to Greece. It is subsequently revealed that as a repercussion of her father's abandonment of her at a young age, Katie possesses severe psychotic tendencies surrounding abandonment. Distraught over Embry's disposal of her, Katie picks up a rock and strikes him from behind repeatedly, killing him.
Attempting to reason with Katie before telling her she can't come with him to New Hampshire, Handler takes notice of something at the bottom of the water. Realizing that it is the skeleton of Embry Larkin, Handler is suddenly struck from behind and falls into the water, echoing Embry's murder two years prior. In the film's epilogue, it is revealed that the dormitory was demolished soon afterward, with plans for the construction of a new structure and thus inadvertently cementing the permanent disappearance of Embry Larkin and Wade Handler.
Katie Burke, now graduated, finally possesses the job she's always wanted; however, when a co-worker informs her that he has been promoted and that the two of them can no longer see each other, a familiar look passes over Katie's face...

Question: Who did Katie have an affair with?
Answer: Handler