The United States is temporarily closing its embassy in Yemen to the public amid a spate of attacks against foreign diplomats, a top US official said Wednesday.