Feature/graceful quit

Wait for termination until postQueue is empty up to 30 seconds.
This part of error diagnosis can be moved inside `api.PostMetricsValues` for simplicity