Fix locking around deleteFile (fixes #64)