How to connect flannges at bends

I am working on center console design, and I added flanges to side. For my design I want to have the front of the console fold out for maintanence and use the flanges to create a seal against the remaining framing for the console. The issue I am having is connecting the flanges together at the bends. Some areas have gaps while others are overlapped. How can I can I fix the gaps and still have it come out as a flat plate.