Since it's in the spec for generators, we should follow it. Here's a revised version:
(define make-directory-files-generator
(case-lambda
((dir dot-files?) (make-directory-files-generator* dir dot-files?))
((dir) (make-directory-files-generator* dir #f))))
(define (make-directory-files-generator* dir dot-files?)
(let ((dir-obj (open-directory dir dot-files?))
(eof (eof-object))
(done #f))
(lambda ()
(if done eof
(let ((f (read-directory dir-obj)))
(when (eq? f eof)
(close-directory dir-obj)
(set! done #t))
f)))))