Set state running before dumping to disk

Fixes #4766

I was so afraid of race condition that forgot about logic :pouting_cat: