rc.subr: Fix slow shutdown issue
Instead of sleeping after pwait returns, use its new -p option to
obtain the list of processes that still have not terminated.
Approved by: re (cperciva)
MFC after: 3 days
PR: 290357
Fixes: 5953e7c98427 ("rc.subr: Move the sleep in wait_for_pids")
Reviewed by: 0mp, markj
Differential Revision: https://reviews.freebsd.org/D53294
(cherry picked from commit 22cff1f3e9d82b48aad440c52f883bfd4995359c)
(cherry picked from commit 7b375832c252430243810ca85d6cbf67820457d5)