Continuity mistake: When Data and Troi are scanning the list of elements, searching for something to cause an explosion, the list is scrolling "up" the screen. When she tells Data to stop and go back, he does, but the list continues to scroll "up" instead of back "down".
Revealing mistake: In an overhead shot of the Brattain, it's clear that the ship's (misspelled) name is just a poorly applied decal.
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.