Make sure _def.r exists before creating _state.txt