RATIS-2100. The `closeFuture` never completed while closing from the `NEW` state (#1102)

diff --git a/ratis-server/src/main/java/org/apache/ratis/server/leader/LogAppenderDaemon.java b/ratis-server/src/main/java/org/apache/ratis/server/leader/LogAppenderDaemon.java
index 8476174..5de3f3b 100644
--- a/ratis-server/src/main/java/org/apache/ratis/server/leader/LogAppenderDaemon.java
+++ b/ratis-server/src/main/java/org/apache/ratis/server/leader/LogAppenderDaemon.java
@@ -108,8 +108,11 @@
   };
 
   public CompletableFuture<State> tryToClose() {
-    if (lifeCycle.transition(TRY_TO_CLOSE) == CLOSING) {
+    final State state = lifeCycle.transition(TRY_TO_CLOSE);
+    if (state == CLOSING) {
       daemon.interrupt();
+    } else if (state == CLOSED) {
+      closeFuture.complete(state);
     }
     return closeFuture;
   }