Treat CURLE_WRITE_ERROR as error too

CURLE_WRITE_ERROR is also an error.
Set error message in context buffer instead of global one.
Cosmetics