Nth Degree - S4-E19
Continuity mistake: When Barclay enters the Holodeck to create an interface, he calls for a chair, an input for the left and a display for the right. When Picard comes to question him, the input and display units are gone.
Nth Degree - S4-E19
Other mistake: After Data reports the bypass blocked, Riker goes to call to Barclay. The chirp preceding the computer, now Barclay's, response occurs almost simultaneously with the call, rather than a second or two gap between the call and chirp.
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.