fix(config): set config prior to returning the closure