fix shutdown for Windows machine - wait in sleep() and mask error during shutdown