Call cleanup for encoder

cleanup sockets