fix cleanup memory (packetbuffer, asyncclose buffer) at terminating
fix compiler warnings
fix name of variable