Path replaceWriter(Path oldPath, Path newPath, W nextWriter) throws IOException {
    return TraceUtil.trace(() -> {
      doReplaceWriter(oldPath, newPath, nextWriter);
      return newPath;
    }, () -> createSpan("WAL.replaceWriter"));
  }
Cleans up current writer closing it and then puts in place the passed in {@code nextWriter}.
<p/>
<ul>
<li>In the case of creating a new WAL, oldPath will be null.</li>
<li>In the case of rolling over from one file to the next, none of the parameters will be null.
</li>
<li>In the case of closing out this FSHLog with no further use newPath and nextWriter will be
null.</li>
</ul>
@param oldPath    may be null
@param newPath    may be null
@param nextWriter may be null
@return the passed in <code>newPath</code>
@throws IOException if there is a problem flushing or closing the underlying FS
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java