fdopen for all os platforms, to fix unclosed file issue

Relating to https://github.com/grangier/python-goose/issues/109#issuecomment-44368156, tmp file remained open