Close the file descriptor when done.
Don't leak the string created by strdup.

Probably harmless if we do since we exit(0) at the end.
Clarify a few things.

 * Change check for id to be 1 <= id <= 3, and print error message if
   it's not true.
 * Add comment that we're "intentionally" writing past the end of
   segname because we're trying to fill out the rest of the
   segment_command.
 * Fix typo in sentence.