Tweaked destructors, program now exits without infinite loop