Fix selection of cpusets and errors while collecting data

Not closing the file descriptor while filtering out processes per cpuset
resulted in printing the user name causing a segfault after a couple of
cycles. Also add checking for success of getpwuid in the print_user
function.