I think the door is to Hermione's door. Mainly because if you take into account the sentence "...But he remained doubled over..." he might not want Hermione rushing back to the door and seeing him inside standing.