you could use a bungie running from one end to the other. But the simplest would be to put a pc of wood on top and use one of those clamps you used to build it with and clamp it to the closet bar with the hanger between.
you could tie a rope or bungie around the clothing so they hag as a joint weight.
And my last idea is a board with padding on the bottom, hinged at one end have it swing down to a catch at the other end of the closet The padding on the bottom of the wood strip would pad the hangers keeping them from moving.
I am thinking of putting a closet in my new build and had not thought about that. But most people fold or roll their clothing.

Ron