You are correct that the buttons do not work when you press sort, as there is a different display of the area where you can drag the buttons around to sort them in the area.
So is the "Done" Button Not Visible? Does it not work when you press it?
Exactly what is locked? Are you able to move the map with the mouse? Are you able to select a unit? How are you exiting the game? Do you press Bail?