Terminate also pending instances.

Added logic to terminate pending instances, and fixed wrong timeout math.