The work done in a conservative force field is guaranteed to be zero only over a closed path.
By definition, a vector field is conservative if and only if there exists a potential function
For a force field, we have the definition of work as:
The Gradient Theorem , aka the Fudamental Theorem for Line Integrals, states that:
This is where the idea of path independence comes from.