wait for process for polite shutdowns