fixed memory leak + video device switching on windows