Changed how household data is written to file

Open each file once and then keep it open. The most expensive part is
opening and closing a file for each household in every iteration where
data is written to file.