writing to multiple files successfully