diff --git a/gnome/src/actions.c b/gnome/src/actions.c
index f7535fbb742ee42fa50bd5847befbcf8bdbb97c4..aafb1839e346d22d7871339d4bcff7c639f293fc 100644
--- a/gnome/src/actions.c
+++ b/gnome/src/actions.c
@@ -158,6 +158,8 @@ sflphone_quit(gboolean force_quit, SFLPhoneClient *client)
         calllist_clean(current_calls_tab);
         calllist_clean(contacts_tab);
         calllist_clean(history_tab);
+        free_addressbook();
+
 #if GLIB_CHECK_VERSION(2,32,0)
         g_application_quit(G_APPLICATION(client));
 #else
diff --git a/gnome/src/contacts/addrbookfactory.c b/gnome/src/contacts/addrbookfactory.c
index 4b4720ff8e77826f45b91d53d9b591778312cd8e..22b733bee5f1c2cd4cffbb4833432bd18811297b 100644
--- a/gnome/src/contacts/addrbookfactory.c
+++ b/gnome/src/contacts/addrbookfactory.c
@@ -84,21 +84,26 @@ handler_async_search(GList *hits, gpointer user_data)
 
 void abook_init()
 {
+    /* Clear any existing error */
+    dlerror();
+
     const gchar *addrbook_path = PLUGINS_DIR "/libevladdrbook.so";
     /* FIXME: handle should be unloaded with dlclose on exit */
     void *handle = dlopen(addrbook_path, RTLD_LAZY);
 
     if (handle == NULL) {
-        g_debug("Did not load addressbook from path %s", addrbook_path);
+        g_debug("Did not load addressbook from path %s:%s", addrbook_path, dlerror());
         return;
     }
 
     addrbook = g_new0(AddrBookHandle, 1);
+    /* Keep the handle around to dlclose it later */
+    addrbook->handle = handle;
 
 #define LOAD(func) do {                                         \
         addrbook-> func = dlsym(handle, "addressbook_" #func);  \
         if (addrbook-> func == NULL) {                          \
-            g_warning("Couldn't load " # func);                 \
+            g_warning("Couldn't load " # func ":%s", dlerror());\
             dlclose(handle);                                    \
             g_free(addrbook);                                   \
             addrbook = NULL;                                    \
@@ -118,3 +123,15 @@ void abook_init()
 
     addrbook->search_cb = handler_async_search;
 }
+
+void
+free_addressbook()
+{
+    if (!addrbook)
+        return;
+
+    if (addrbook->handle)
+        dlclose(addrbook->handle);
+
+    g_free(addrbook);
+}
diff --git a/gnome/src/contacts/addrbookfactory.h b/gnome/src/contacts/addrbookfactory.h
index 523e44b05ea52fffa740efb7fe5f9cfd2ec7f07f..a03bc85b35d76a0c5328dde93db2102ce8ea9f88 100644
--- a/gnome/src/contacts/addrbookfactory.h
+++ b/gnome/src/contacts/addrbookfactory.h
@@ -35,6 +35,7 @@
 #include "addressbook.h"
 
 void abook_init();
+void free_addressbook();
 
 extern AddrBookHandle *addrbook;
 
diff --git a/gnome/src/contacts/addressbook.h b/gnome/src/contacts/addressbook.h
index bd3b0834653a8fa4acc45ec5d8b64ca54215cdbe..d430e63a286db157d9c1366fa45a26244ab5f381 100644
--- a/gnome/src/contacts/addressbook.h
+++ b/gnome/src/contacts/addressbook.h
@@ -86,6 +86,7 @@ struct AddrBookHandle {
     void (*set_current_book)(const gchar *);
     void (*set_search_type)(AddrbookSearchType);
     void (*search_cb)(GList *, gpointer);
+    void *handle;
 };
 
 #endif