Had locked dicretory instead of had locked file.
Merge pull request #2 from genzouw/master

Lock file, instead of lock dir.