test threading, write to file