Added 'wait till session finishes' function to deal with BrowserStack sessions hanging