private static void closeStreams(StreamManager streamManager, List<StreamMetadata> streams,
        Map<Long, Long> streamEndOffsets, Logger logger) throws InterruptedException, ExecutionException {
        for (StreamMetadata stream : streams) {
            long newEndOffset = streamEndOffsets.getOrDefault(stream.streamId(), stream.endOffset());
            logger.info("recover try close stream {} with new end offset {}", stream, newEndOffset);
        }
        CompletableFuture.allOf(
            streams.stream()
                .map(s -> streamManager.closeStream(s.streamId(), s.epoch()))
                .toArray(CompletableFuture[]::new)
        ).get();
    }
Recover WAL, upload WAL to S3 and close opening streams.
Note: {@link WriteAheadLog#start()} should be called before this method.
s3stream/src/main/java/com/automq/stream/s3/S3Storage.java