ENH Infrastructure to pass options to read/write

This is more generic than the previous metadata option of adding a new
function.
BUG Fix error path

If an error happened when opening the file, the array would have its
reference count wrong.

Also, now imread checks whether it can write the format before possibly
creating a new file. Thus, it avoids creating an empty file (or
overwriting an existing one) on error.
ENH JPEG quality option
ENH Support for 64 bits

Currently, this just gives better error messages when trying to save
them in JPEG format.