diff --git a/src/couchdb/couch_api_wrap.erl b/src/couchdb/couch_api_wrap.erl
index 5d9c673..aa481c7 100644
--- a/src/couchdb/couch_api_wrap.erl
+++ b/src/couchdb/couch_api_wrap.erl
@@ -104,7 +104,7 @@ db_close(#httpdb{httpc_pool = Pool}) ->
     unlink(Pool),
     ok = couch_httpc_pool:stop(Pool);
 db_close(DbName) ->
-    couch_db:close(DbName).
+    catch couch_db:close(DbName).
 
 
 get_db_info(#httpdb{} = Db) ->
diff --git a/src/couchdb/couch_replicator.erl b/src/couchdb/couch_replicator.erl
index aca2fca..c559c91 100644
--- a/src/couchdb/couch_replicator.erl
+++ b/src/couchdb/couch_replicator.erl
@@ -478,7 +478,9 @@ terminate(Reason, State) ->
 terminate_cleanup(State) ->
     couch_task_status:update("Finishing"),
     stop_db_compaction_notifier(State#rep_state.source_db_compaction_notifier),
-    stop_db_compaction_notifier(State#rep_state.target_db_compaction_notifier).
+    stop_db_compaction_notifier(State#rep_state.target_db_compaction_notifier),
+    couch_api_wrap:db_close(State#rep_state.source),
+    couch_api_wrap:db_close(State#rep_state.target).
 
 
 do_last_checkpoint(#rep_state{seqs_in_progress = [],
