fixed leak of resource in sftp->ensureDirectoryExists()

cleanup after a successfull call to opendir(), so the OS will not get
out of resource handles on long running processes.