Harden gres logic

Test for NULL array pointers before trying to free the array elements.
We are not seeing problems with this, but just hardening the code.
switch/nrt unload job table in user space mode

switch/nrt - Unload job tables (in addition to windows) in user space mode
to avoid leaking NRT.
bug 964