Portable file locking implementation for R