Fix synchronization issue of state controller.
Change method for creating a lock file.