fix: set status properties before write the status into file

Order between setting status properties and writing status properties
made problems. Writing uses status properties so that setting status
properties is priorier than writing status.