Generalizable Imitation Learning from Observation via Inferring Goal Proximity