More robust fetch_osc_and_apply.sh

Adds a better handeling of state files (in some rare cases of race condition, the state file was updated to a blank state) this commit adds a retry mechanism in case the state file isn't yet available.

I've been running it for 2 weeks and that is now much better