[Windows] Use pywin32 to get long filenames for latex
Add file handling workaround for pdflatex

pdflatex seems to be unable to open an already opened file a seconds time, so we close our tempfile before using it