Fixed crashing when image file couldn't be opened.