Fix buck in package manager error handling
Add file level locking utility (originally from dist_job_mgr)