The ruling capped an extraordinary legal back-and-forth over the humaneness of nitrogen gas as an execution method.