Continuity mistake: When Data goes into his laughing fit, Troi is at her regular seat, but when he stops and remarks it was a wonderful feeling, the wide shot of the crew shows her seat empty. But then, when Picard is hailed, when the moon returns to its orbit, Troi is back at her seat.
Continuity mistake: As Q approaches Picard and Riker's position while playing a trumpet, both of Q's hands are on the horn. A second later, his left hand is down by his side. Then, after he makes cigars appear in Picard and Riker's mouths, his left hand is extended as he says the first part of his lines. A second later, both hands are on his horn.
Answer: Yes. The doors to the holodecks can be locked when in use by anyone aboard the Enterprise so they couldn't be disturbed. However, high ranking officers like Captain Picard could override the doors as it's seen that overrides are in use even for the crews quarters. Even Barclay, when he's indulging in one of his fantasies could have the doors to the holodeck unlocked by an override code.