[fix][io/posix] close and shutdown missing
[fix][io/posix] close or shutdown on error
[feature] layer chain destroy and free
Merge pull request #83 from xively/memory_leak_fixes

Memory leak fixes