replace NamedTemporaryFile with tmpfile

For windows compatibility
tmpfile doesn't close unclosable files