Court battles and dealmaking are deciding the future of many of those last men at the U.S. naval base in Cuba, including those charged in some of the gravest attacks of the 21st century.