Simple flock-based file locking using Python's `with` syntax