clean=various ifdef reduction

Signed-off-by: Andy Green <andy.green@linaro.org>
close should flush any truncated send before really closing

Signed-off-by: Andy Green <andy.green@linaro.org>