Fix broken callback in saveImage

saveImage only calls the callback method under error conditions.  Fixed
so that it also calls it when saveImage successfully writes the image
file to disk.

Callback was not being checked for presence, so if it wasn't passed in
an exception would be thrown. Fixed to provide a dummy callback if the
caller didn't specify one.

Removed spurious console logging on successful image write and fixed
some formatting in writeFile.