Internal investigation cleared the national security adviser Mike Waltz, but the mistake was months in the making