Feature/graceful quit

Wait for termination until postQueue is empty up to 30 seconds.
I like loopStateTerminating for this