Fix memory leak

Delete output_instance after use to prevent memory leak, which can cause a crash on very long jobs.
FIX Memory leak (thanks to bwilk7).