New: report output to a file (fixes #1027)

This merge would allow user to supply the reportOutput option with the specified file path and the output would be written to that file.
This would help us to generate pretty reports using HTML.
This needs to be done with `writeFileSync`. This utility is purely synchronous.

Also, we shouldn't be outputting additional log messages here. For an error state, just throw the error (or let it be thrown).