Add support for saving metadata on queries.

I think we should just always save the metadata file and not add a command line option unless there's a real use case for it.