code: func (f *fifo) Close() (retErr error) {
  	for {
  		select {
  		case <-f.closed:
  			f.handle.Close()
  			return
  		default:
  			select {
  			case <-f.opened:
  				f.closedOnce.Do(func() {
  					retErr = f.file.Close()
  					f.err = retErr
  					close(f.closed)
  				})
  			default:
  				if f.flag&syscall.O_RDWR != 0 {
  					runtime.Gosched()
  					break
  				}
  				f.closingOnce.Do(func() {
  					close(f.closing)
  				})
  				reverseMode := syscall.O_WRONLY
  				if f.flag&syscall.O_WRONLY > 0 {
  					reverseMode = syscall.O_RDONLY
  				}
  				fn, err := f.handle.Path()
  				// if Close() is called concurrently(shouldn't) it may cause error
  				// because handle is closed
  				select {
  				case <-f.closed:
  				default:
  					if err != nil {
  						// Path has become invalid. We will leak a goroutine.
  						// This case should not happen in linux.
  						f.closedOnce.Do(func() {
  							f.err = err
  							close(f.closed)
  						})
  						<-f.closed
  						break
  					}
  					f, err := os.OpenFile(fn, reverseMode|syscall.O_NONBLOCK, 0)
  					if err == nil {
  						f.Close()
  					}
  					runtime.Gosched()
  				}
  			}
  		}
  	}
  }
docs: // Close the fifo. Next reads/writes will error. This method can also be used
  // before open(2) has returned and fifo was never opened.