Fix module searching bug when import is cirular

This bug is reported by Seth Alves, with the following test code.

(define-library (ok fuh)
  (export something)
  (import (ok fuh))
  (begin
    (define (something x) #f)))

(import (scheme base)
        (scheme write)
        (ok fuh))

(display "ok\n")
(newline)

It turned out to be tricky to construct a minimal test case that exhibits
this bug with standard Gauche module utilities (as opposed to using r7rs
features), so we don't include test case at the moment.