Handle errors when grabbing the browser screenshot

pytest internal errors were being caused in cases where either the
browser was closed when we tried to grab the screenshot, or otherwise
it was invalid (UnexpectedAlertException, for example). pytest internal
errors are bad, so this prevents them from occurring.