Many thanks for the advice so far.
Do you all agree that if the main character, David, hadn't closed his eyes it would not be head-hopping (putting to one side, of course, that it is the act of closing his eyes mid-conversation that has puzzled John and William)?
You still haven't told us what POV or narrative style this scene is supposed to be in.
Is it written from David's POV?
If it's written from David's POV, then even with his eyes open this could still be considered head-hopping, because he can't know for a certainty that John and William are looking at each other in confusion. He could guess from their expressions, but the sentence would need to imply that he was guessing.
Unless, of course, you've already established David as an unreliable narrator, but let's not go into that.
Is it written from John or William's POV?
Same basic principles apply here as do above. If it's written from one person's POV, then the reader should only see and know things that character knows.
Is it written from an omniscient POV--where the narrator knows what's going on in the heads of all the characters at all times?
If this is an omniscient POV then, as Shweta said up-page, this isn't head-hopping, but it's not really a smooth transition between knowledge states and could do with some work.
Of course, if it's omni, then where in the book it is becomes an issue. If we're used to the omni POV we might not be bothered by that transition.
We need more information than you're giving us to offer advice that isn't based on assumptions about the scene and POV and narrative structure (and i can't help but wonder if soon we're going to see a post that says, 'this is from such-and-such a book').