Layer-dependent third-harmonic generation in multilayer graphene