Bugfix

Scheduler now closes smoothly
All threads terminate on close