Predator avoidance and foraging for food shape synchrony and response to perturbations in trophic metacommunities