A fast and optimized version that ensures instructions are set and the panel is closed without delay.