Fix crash

Was accidentally freeing the script environment twice when reopening a
script whose evaluation previously failed.