code: func (l *WAL) Close() error {
  	l.mu.Lock()
  	defer l.mu.Unlock()
  
  	l.once.Do(func() {
  		// Close, but don't set to nil so future goroutines can still be signaled
  		l.traceLogger.Info("Closing WAL file", zap.String("path", l.path))
  		close(l.closing)
  
  		if l.currentSegmentWriter != nil {
  			l.sync()
  			l.currentSegmentWriter.close()
  			l.currentSegmentWriter = nil
  		}
  	})
  
  	return nil
  }
docs: // Close will finish any flush that is currently in progress and close file handles.