echo: check the socket is ready for writes

procket:write/2 was occasionally returning {error, eagain}.
echo: remove the fd before closing the socket
inert_drv: return the length from inert_copy

Instead of indicating success/failure, return the number of bytes
copied. Since this function is used so far only for making atoms and to
avoid the sign issues, restrict the copy to MAXATOMLEN bytes.

Like the erl_driver control callback, inert_copy takes a buffer with an
unsigned length and returns a signed length.