Improving the reliability of the --auto-restart switch

This commit fixes two issues related with the --auto-restart switch in
case the browser crashes or is terminated forcefully:
- an exception in the main thread could sometimes happen, preventing
any further restart of the web browser
- the delay before the browser was restarted was too large because of
the call to driver.quit