Fix bug in closing function when startup was incomplete