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

Currently, this causes permission error on Windows platform