fix pthread flag

the correct flag is -lpthread, not -pthread. Also, use it only on
windows, the only place where it is necessary