Waiting for output streams to have finished before exiting grunt.

When calling ``grunt`` and piping its output to some other application (this happens for example when calling it from Cygwin bash under Windows, or as part of a larger build process), the end of the output from Grunt is often lost, because Grunt is exiting before all the data has been sent.

This pull request adds some code to make sure all the output has been received by ``stdin`` and ``stdout`` before exiting.

You can check this for more information:
https://groups.google.com/forum/?fromgroups=#!topic/nodejs-dev/Tj_HNQbvtZs