Work done in the motion of a body over a closed loop is zero only when the body is moving under the action of conservative forces (like gravitational or electrostatic forces). It is not zero when the forces are non-conservative e.g. frictional forces etc.