US court bars Trump from reversing transgender troops policy