Flames inch close to California homes as thousands evacuate