Window_Base dispose window error

Hello,
I have just started to try to script, not using any tutorials. The script I will put up is supposed to give you the options to go to the title and to shutdown when you get a game over. It gives me an error for Window_Base on line 114 (it is a RGSSerror) then on the next line it just says " dispose window".
Here is the script:

Spoiler
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
# This class performs game over screen processing.
#==============================================================================

class Scene_Gameover < Scene_Base
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
play_gameover_music
fadeout_frozen_graphics
create_background
create_command_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_background
close_command_window
end
#--------------------------------------------------------------------------
# * Execute Transition
#--------------------------------------------------------------------------
def perform_transition
Graphics.transition(fadein_speed)
end
#--------------------------------------------------------------------------
# * Play Music on Game Over Screen
#--------------------------------------------------------------------------
def play_gameover_music
RPG::BGM.stop
RPG::BGS.stop
$data_system.gameover_me.play
end
#--------------------------------------------------------------------------
# * Fade Out Frozen Graphics
#--------------------------------------------------------------------------
def fadeout_frozen_graphics
Graphics.transition(fadeout_speed)
Graphics.freeze
end
#--------------------------------------------------------------------------
# * Create Background
#--------------------------------------------------------------------------
def create_background
@sprite = Sprite.new
@sprite.bitmap = Cache.system("GameOver")
end
#--------------------------------------------------------------------------
# * Free Background
#--------------------------------------------------------------------------
def dispose_background
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Get Fade Out Speed
#--------------------------------------------------------------------------
def fadeout_speed
return 60
end
#--------------------------------------------------------------------------
# * Get Fade In Speed
#--------------------------------------------------------------------------
def fadein_speed
return 120
end
#--------------------------------------------------------------------------
# * Transition to Title Screen
#--------------------------------------------------------------------------
def goto_title
fadeout_all
SceneManager.goto(Scene_Title)
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_GameEnd.new
@command_window.set_handler🙂to_title, method🙂command_to_title))
@command_window.set_handler🙂shutdown, method🙂command_shutdown))
end
#--------------------------------------------------------------------------
# * Close Command Window
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
update until @command_window.close?
end
#--------------------------------------------------------------------------
# * [Go to Title] Command
#--------------------------------------------------------------------------
def command_to_title
close_command_window
fadeout_all
SceneManager.goto(Scene_Title)
end
#--------------------------------------------------------------------------
# * [shut Down] Command
#--------------------------------------------------------------------------
def command_shutdown
close_command_window
fadeout_all
SceneManager.exit
end
end
Can anyone help? (Oh, btw. The error appears when I chose an option).
Please post a screenshot of the error message and link to all scripts you've added, as there is no function dispose_window in the game.

If you don't have any programming knowledge, then you should either do a ruby tutorial before working on scripts, or stay at the eventing level (no script editor) until you're more comfortable with scripting (which is the same as programming in RM)
1 is the selection of the choice, 2 is the error.

1.PNG

2.PNG
I don't know for sure, but to me it looks like you're trying to close a windows that no longer exists - which means the true error is at a differend position.

Install the following script and check where the error message was truly caused:

http://himeworks.wordpress.com/2013/06/09/custom-main-full-error-backtrace/
def terminatesuperdispose_backgroundclose_command_windowendTake out the `close_command_window`.The Scene_Base terminate method disposes all windows so if you try to do something with the window afterwards you're going to get that error.
def terminatesuperdispose_backgroundclose_command_windowendTake out the `close_command_window`.The Scene_Base terminate method disposes all windows so if you try to do something with the window afterwards you're going to get that error.
Thanks, that worked.
Next time you want to post code, please use

Code:
 tags so formatting is kept - it makes it much easier to follow what's going on. And also use spoiler tags, as you've done (outside the code tags) if it's a long script.
[B]This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.[/B]

Original thread: https://forums.rpgmakerweb.com/threads/window_base-dispose-window-error.17703/