Fix for undefined error

When using 'fs-extra' I was getting callback is undefined error messages. This adds a check to make sure the callback is defined before calling it (basically makes the callback optional).