Catch exceptions within staticimg task and reraise only after webdriver
is quit cleanly. Fixes #272