system uses a latch instead of while loop while waiting to shut down.