implemented file locking to ensure you cant open a file, unlink it, and then write to it