Observation of the crossover between bulk flux pinning and Josephson phase slips in the critical current of granular superconducting NbN/AlN multilayer films