All Good Things... (1) - S7-E25
Other mistake: When Picard first meets Data in the past, Data's rank insignia is wrong. He's always held the rank of Lieutenant Commander, signified by two gold pips, and one with black in the center. However, Data has one gold, one with black, signifying Lieutenant.
Gambit (2) - S7-E5
Other mistake: When the raiders' vessel fires on the Enterprise, only the starboard nacelle is hit. Right after the impact, Worf reports the port nacelle hit, then the starboard.
Other mistake: When the ship is at max warp and Geordi states that at maximum warp the ship can only sustain two hours of emergency life support, Data, Troi and Worf are on the holodeck attempting to stop the train, but back in the bridge before they do you can see the view screen in the background and the bridge glass dome above Geordi, Picard and Riker that the ship is not moving at warp speed and is at standstill.
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.