Age-dependent cognitive inflexibility in great apes