It's not the lock on the file, it's the lock on the directory. The common file dialog in Windows changes the current directory of the process to the file that was selected, and a Win32 process holds a lock on its current directory. So when you open readme.txt in a particular folder, Notepad.exe's current directory is changed to and holds a lock on that folder.
This is also why so many people run into problems trying to eject removable drives -- because the last thing they did was to save a file onto that drive, and now Outlook or whatever the program that did the save has its current directory pointing there.