Spin-polarization effects for electrons passing through thin iron and cobalt films