Added safety checks to avoid problems when windows VSTs are closed by a hooked keypress.