lock files and force flush