Trump administration's bid to cancel teacher training grants thwarted as judge raises alarm over cuts