[processing] use csv module for table writer
[processing] fix Statistics by categories algorithm
[processing] write table header only when necessary
adopt Point distance alg to use OutputTable