Only locks on file modification

This update ensures that the file only locks when it is modified, allowing normal use of Cmd+P etc.
Merge pull request #1 from kirknorthrop/on_modified

Only locks on file modification