Add better error handling for savePicture and restorePicture

If an Exception occurs when storing the file treat this as an error
and always fail to try to prevent corrupted pictures to be stored to
the file system.

Close files if they were opened, the caller might want to perform other
file operations on the file and if it is still open these may fail.

Change-Id: Ic68596b5c745bbe413096c22684c388e853a7643
1 file changed