Fix #66: Close popup box when target is no longer valid