Heap memory leak problem when ledger replication failed (#2794)

### Motivation

production environment, memory leak always happened, and there were ledger cannot be replicated successfully.



This cause by when `openLedgerNoRecovery` with `BKNotEnoughBookiesException`,  the LedgerHandler won't  closed properly, caused memory leak

https://github.com/apache/bookkeeper/blob/c7236adc3cb659e65ae5ce53b7156569d7f50ebd/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java#L364-L424

### Changes

close LedgerHandler when openComplete with exception
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
index 2193b3e..e74fcb6 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerOpenOp.java
@@ -129,6 +129,19 @@
         initiate();
     }
 
+    private void closeLedgerHandle() {
+        try {
+            if (lh != null) {
+                lh.close();
+            }
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            LOG.info("InterruptedException while closing ledger {}", ledgerId, e);
+        } catch (BKException e) {
+            LOG.warn("BKException while closing ledger {} ", ledgerId, e);
+        }
+    }
+
     private void openWithMetadata(Versioned<LedgerMetadata> versionedMetadata) {
         LedgerMetadata metadata = versionedMetadata.getValue();
 
@@ -196,8 +209,10 @@
                     if (rc == BKException.Code.OK) {
                         openComplete(BKException.Code.OK, lh);
                     } else if (rc == BKException.Code.UnauthorizedAccessException) {
+                        closeLedgerHandle();
                         openComplete(BKException.Code.UnauthorizedAccessException, null);
                     } else {
+                        closeLedgerHandle();
                         openComplete(bk.getReturnRc(BKException.Code.LedgerRecoveryException), null);
                     }
                 }
@@ -212,6 +227,7 @@
                 public void readLastConfirmedComplete(int rc,
                         long lastConfirmed, Object ctx) {
                     if (rc != BKException.Code.OK) {
+                        closeLedgerHandle();
                         openComplete(bk.getReturnRc(BKException.Code.ReadException), null);
                     } else {
                         lh.lastAddConfirmed = lh.lastAddPushed = lastConfirmed;