Fix traceback when --product/--add-install not found

Obviously, if we get an exception here then 'tx' isn't going to be set.
So make sure we only refer to it in the 'else' block of the try/except.