Making sure temporary named file is created with 'w' mode.
Currently, this causes permission error on Windows platform
Merge pull request #621 from NghiaNguyen/master

Making sure temporary named file is created with 'w' mode.