Handle flow close events