Properly close connections on couch backend (#5493).
Prevent file descriptor leaks on tests.
Merge remote-tracking branch 'refs/remotes/drebs/bug/5493_avoid-file-descriptor-leaks' into develop