GUACAMOLE-234: Fix bind issue that occurs using try-with-resources.
diff --git a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPConnectionService.java b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPConnectionService.java
index 49a3f7c..7141a79 100644
--- a/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPConnectionService.java
+++ b/extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/LDAPConnectionService.java
@@ -129,7 +129,8 @@
             throws GuacamoleException {
 
         // Get ldapConnection and try to connect and bind.
-        try (LdapNetworkConnection ldapConnection = createLDAPConnection()) {
+        LdapNetworkConnection ldapConnection = createLDAPConnection();
+        try {
 
             // Connect to LDAP server
             ldapConnection.connect();
@@ -155,6 +156,7 @@
 
         // Disconnect if an error occurs during bind
         catch (LdapException e) {
+            ldapConnection.close();
             logger.debug("Unable to bind to LDAP server.", e);
             throw new GuacamoleInvalidCredentialsException(
                     "Unable to bind to the LDAP server.",