handle file/image saving errors; fixes #679