Cathy is physically freed from the room in the morning, although she remains emotionally trapped. She is forced into marriage with Linton, & is not allowed to return to the Grange to see her dying father. In order to cover up the kidnapping, Heathcliff concocts a story, saying he rescued Nelly and Cathy from drowning.
Nelly is kept locked in the room for four days. When she is released, she finds out about Heathcliff's story, as well as the fact that Edgar may only have a day to live. She escapes, & attempts to change his will. Cathy finally convinces Linton to help her sneak out as well, arriving in time to say goodbye to her father. However, both women are taken once again with Heathcliff, so you may say that their imprisonment continues up until Heathcliff's death.