Fix null-reference errors from extension-tests

I was getting errors when running the tests with `npm test` which seemed to indicate a null reference issue. Did some digging:

The callback functions in the extension tests were assuming they get either an `Error` or the extension object as a first parameter, but were being called with a possible error on first parameter, then extension as second.

Made some variables local while I was in there.
if (!err)