Add headless agent mode in config ini file and arguments. By default disable
headless.
Also make test more robust by converting checks to wait_for checks, also issue
timer fire from test after stopping taskscheduler.