writeFileSync: close the fd on success.

  This patch force the file descriptor open by writeFileSync to be
  closed on success (it was closed only on write error).

  Our Node.js application was throwing `EMFILE, too many open files'
  because file descriptors open by writeFileSync were never released.
  Sadly, this kind of bug is too much setup and platform dependent to be
  tested (we discovered it in production).

  Sponsored by: Net Oxygen (http://netoxygen.ch)