do a more sophisticated approach to file locking