Set close-on-exec when opening files

Merged Alan Coopersmith requested to merge alanc/libxpm:cloexec into master

Relies on platforms with O_CLOEXEC support following POSIX requirement to not copy the close-on-exec flag to the new fd in dup2(), but to leave it unset instead, since that's how fd's are passed to child processes to handled compressed files.

Also adds a unit test for the rgb file reading code, so we can make sure it still works with this change.

Merge request reports