Improving errors when creating packages by first checking if file exists

This will avoid the PHP Warning:  fopen(  when a file does not exist.