Better detection for last open panel