Make to_csv return a string in case no buffer is supplied.

Fixes issue #6061.
Merge pull request #6406 from filmor/patch-2

Make to_csv return a string if no path or buffer is provided.