Adding more descriptive error message in order to better understand why files can not be written
Fixing GUI crashing issue due to some debugging code that was not doing adequate null pointer checking. The error would manifest itself if the user clicked in the empty image viewer on the right hand side.