Refactor #3878 #3922 #3963 #3983: Make temporary proto variable deletable on windows
Previous solution doesn't work on windows