In this paper we study flexible algebras (possibly infinite-dimensional) satisfying the polynomial identity x(yz) = y(zx). We prove that in these algebras, products of five elements are associative and commutative. As a consequence of this, we get that when such an algebra is a nil-algebra of bounded nil-index, it is nilpotent. Furthermore, we obtain optimal bounds for the index of nilpotency. Another consequence that we get is that these algebras are associative when they are semiprime.