pipe: fix incorrect caching of pipe state over pipe_wait()