Fix locals dict state for closures