Log file-open failures

I added some error messages in cases where a file isn't found or can't be opened. It's nice to know right away when this is the case instead of silent failure and then wondering why an image isn't being displayed, sound being played, etc.

Where possible I tried to check whether the file was actually opened successfully, instead of checking for file existence before trying to open it. The latter approach can miss some corner cases such as if the file has incorrect permissions.