Thickness dependence of the current density distribution in superconducting films