- close only if f is valid