Hide previous panel properly before switching