*WaitForEnd function runs in a separate thread
*is_active_run is now set True after looking for resources
*removing lock from resource acquisition step (with above it is not needed anymore)
*restart is disabled while WaitForEnd waits for processes to finish
script to test run end and new run startup in case of hanging processes