Heathcliff is an antihero of Emily Bronte's Wuthering Heights. He is portrayed as a cranky person, full of vengeance and violence. When the love of his life, Catherine, dies, his mental state begins to deteriorate. Up until this point in the novel, Heathcliff has been full of vengeance and violence, but he's changed now. He starts walking on the moors in the middle of the night instead. He doesn't eat or drink hardly anything and he starts talking to the air, but he seems happy for the first time ever. One evening, Heathcliff bars himself in his room. Nelly forces her way in the next morning to find the window hanging open and Heathcliff dead, soaked with rainwater, his eyes open and his mouth smiling.
Heathcliff admits to Nelly, the maid at Wuthering Heights, that he wishes he could still work up the energy to wreak havoc on Cathy, Hareton, and people in general. He just can't -- at this point in his life, all he wants is to be reunited with Catherine Earnshaw. He stops eating and mostly stops socializing at all.
Heathcliff's death is another opportunity for him to get closer to Catherine. He opens the window. It lets the wind and rain and general nature outside into the room, and it also allows Catherine's ghost to enter the house and be with Heathcliff.
While Bronte never explicitly says that Catherine's ghost is actually haunting Wuthering Heights (or even exists at all), Heathcliff's belief in her ghost is enough. A closed window will stop a ghost from entering, so Heathcliff lets his hang wide open.
Finally, Heathcliff dies of starvation at the end of the story. Lockwood returns to Wuthering Heights in chapter 32, he learns of the death of Heathcliff, which had happened three months prior. His actual death is recounted in chapter 34, by Nelly Dean.