using write stream

- fs write opens too many files
- using wite stream... seems to work