Checks if lock file exists and exits the tasks