Add command-line flags to control output format and limit.

JSON format isn't implemented yet.
Add a missing call to Close() the opened ELF file.