RAII for windows api