Initialize 'status' before try block
It seems that despite setting it in the 'except BaseException' block, it is still occasionally undefined in the 'finally' block when triggered by a SystemExit exception.
This should hopefully prevent UnboundLocalError from being raised from the 'finally' block from now on
Resolves #4236 (closed).
Migrated from D8207 (view on Phabricator)