Changed writeFile to asynchronous and made options an Object.

I was getting a timeout in my Mocha test using takeScreenshot, probably due to an exception being thrown.  Making these changes resolved the issue.  Since writeFileSync doesn't accept a callback parameter I changed it to asynchronous writeFile.