windows bug fixed: closing popup window too soon stopped code execution