Fixed realpath being used on output file path and failing when it does not exist.