Fixed Query Handler Thread exit Bug

Thread should now gracefully exit whenever anything sets the amIDone
variable to True.