Make sure to flush stdout and stderr before exit

This is needed when the ouput of jake is a pipe as in this case,
process.output and process.stderr are non blocking.
Merge pull request #224 from vmeurisse/pipe

Make sure to flush stdout and stderr before exit