Core: don't spin 100% CPU when disabling refresh_interval

If refresh was already running when the refresh_interval is
dynamically disabled (set to a non-positive value like 0, -1, etc.),
then it's possible for the refresh thread to go into while (true)
refresh() loop.

Closes #8085

Closes #8087
[TEST] Reenable threadleak filters with 5 sec. lingering