copying to files in w mode.