Fix hang on shutdown with printer redirection

Fixes issue #1404, now using WaitForMultipleObjects