lock implemented with file lock rather than threading