Fixed file locking to be linux compatible.