Corrected error with unused variable
Added closing of LDAP connection