Consequences of stand thinning for bark beetles: direct and indirect effects