The FBI director, Christopher Wray, said Tuesday that the bureau's background investigation into Rob Porter, the White House staff secretary who resigned after spousal-abuse allegations, was formally closed in January. But the White House allowed Porter to continue serving in his post until the accusations surfaced publicly in news reports last week.