diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index f34930a37bc1c0f59829d9f9fcf91a59331363ba..178d26ef57bdcdf9790e381afada3b1f7c783cc2 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -281,14 +281,18 @@ (define conn (ftp-open server))
                                       (release-file project file))
                                      (_ #f))
                                     entries)))
+             (ftp-close conn)
              (and=> (reduce latest #f files)
                     (cut cons <> directory))))
           ((subdirs ...)
            ;; Assume that SUBDIRS correspond to versions, and jump into the
            ;; one with the highest version number.
            (let ((target (reduce latest #f subdirs)))
-             (and target
-                  (loop (string-append directory "/" target))))))))))
+             (if target
+                 (loop (string-append directory "/" target))
+                 (begin
+                   (ftp-close conn)
+                   #f)))))))))
 
 (define %package-name-rx
   ;; Regexp for a package name, e.g., "foo-X.Y".  Since TeXmacs uses