Justices throw out case and direct local appeals courts to dismiss similar suits as moot now that the former US president is no longer in office