A federal judge has dismissed charges against Trump, leaving the door open for future prosecution when his second term in office ends.