test writing to file