Single-particle spectral function of the Λ hyperon in finite nuclei