fix file leak
libsx/client: check more close() after write (bb#476)