dyn_fsync: add sync on reboot/shutdown and fix resume