Pacific Heights

Carter Hayes (Michael Keaton) is in bed with a woman, Ann Miller (Beverly D'Angelo) when he is suddenly attacked and beaten by two men. After the men have left, Hayes tells Ann, "The worst is over". He says he is planning to head out and see his family.
The scene shifts to San Francisco, where an unmarried couple, Drake Goodman (Modine) and Patty Palmer (Griffith), purchase an expensive 19th-century polychrome house in the exclusive Pacific Heights neighborhood. They rent one of the building's two first-floor apartments to the Watanabes, a kindly Japanese couple who have no children. Not long after, Hayes visits to view the remaining vacant unit and immediately expresses a desire to move in. Hayes drives an expensive Porsche and carries large amounts of cash on his person, but is reluctant to undergo a credit check. He convinces Drake to waive the credit check in exchange for a list of personal references and an upfront payment of the first six months' rent, to be paid by wire transfer.
Before any of this money is paid, however, Hayes arrives unannounced one morning and shuts himself into the apartment. As days pass, Drake and Patty grow increasingly impatient when Hayes' wire transfer fails to materialize. From inside the apartment, sounds of loud hammering and drilling are heard at all hours of the day and night, however the door is seldom answered. When Drake finally makes an attempt to enter Hayes' apartment, he finds that the locks have been changed. Drake attempts to put an end to the constant noise and drive out Hayes by cutting the electricity and heat to the apartment, but Hayes summons the police, who side with Hayes and warn Drake that his actions are unlawful and could result in a civil suit.
Drake and Patty hire a lawyer, Stephanie MacDonald (Laurie Metcalf). However, the case to evict Hayes is thwarted by Drake's earlier attempt to disconnect the utilities. Hayes, safe from eviction for the time being, deliberately infests the house with cockroaches, which prompts the Watanabes to move out and pushes Drake and Patty further into debt. The heavy stress takes its toll on the couple; Drake is driven to alcoholism and Patty has a miscarriage. Hayes visits the couple to offer his condolences, but an infuriated Drake attacks him and is arrested by the police, whom Hayes had already called to the scene in anticipation of an assault.
The assault allows Hayes to file a civil lawsuit against Drake and assume control of Drake's possessions and identity (although the couple are not immediately aware of this). Hayes also files a restraining order, which forces Drake from the building. Once Drake is gone, Hayes begins stalking and harassing Patty, in a ploy to lure Drake back to the building in violation of the restraining order. The ploy succeeds, as Drake becomes increasingly leery and enters the building one night to check on Patty. Hayes confronts Drake in the hallway and shoots him, then plants a crowbar at the scene to prevent any criminal charges.
While Drake is recuperating in the hospital, the eviction is finally handed down and authorities force entry into Hayes' apartment. By this time however, Hayes has vanished without a trace, and the apartment has been destroyed and stripped bare of all its appliances, light fixtures, wood paneling and even the toilet.
Some days later, while cleaning out the apartment, Patty finds an important clue: an old photograph of Hayes as a young boy. Written on the back of the photograph is the name "James Danforth", which Patty correctly surmises is Hayes' real name. She phones Bennett Fidlow (Jerry Hardin), the Texas attorney whom Danforth had provided as a reference when he first moved in (albeit under his Hayes alias). Fidlow confides to her that Danforth has a long history of wrongdoing and has been disowned by his family.
Patty travels to Danforth's last-known address, a condominium in Desert Spring. There she finds Ann, his girlfriend and previous co-conspirator who had earlier come looking for him in San Francisco. Ann tells Patty that Carter Hayes is the name of the property's former landlord, and that Danforth assumed Hayes' identity and took possession of the condominium after (the genuine) Hayes hired two thugs to carry out the assault shown in the film's opening scene. Ann also shows Patty a postcard from Danforth, written on the letterhead of a hotel in Century City, which had arrived in the mail just the day before.
Patty tracks down Danforth at the hotel, where he has checked in under Drake's name. Patty bluffs her way into his suite by posing as his wife, and while rummaging through his personal effects she discovers he is using legal and financial documents in Drake's name. She calls Drake and tells him to cancel all of his credit cards and freeze the couple's joint bank account. She then places an exorbitant order for room service, which leads to Danforth being arrested.
Danforth is bailed out of prison by a wealthy widow, Florence Peters (played by Hedren), whom he was apparently vetting to be his next victim. Once out on bail, Danforth returns to San Francisco to seek revenge against Patty and Drake. Upstairs, he bludgeons Drake with a golf club, then attacks Patty in the downstairs apartment where she is busy making repairs. A struggle ensues between Patty and Danforth, and a badly wounded Drake makes his way into the crawl space between the basement and the first-floor apartment. He reaches through a hole in the floor and grabs Danforth by the ankle; Danforth loses his balance and is killed when he falls backward and is impaled by a water supply line.
Some time later, Patty and Drake have put their newly repaired building up for sale and are seen showing the property to another couple. The story ends with the couple having a private discussion about making an offer of $850,000, which is $100,000 more than what Drake and Patty had originally paid for it.

Question: Who shuts himself into the apartment?
Answer: Hayes