Fixed a bug where the final newline in a function definition was not added correctly.
Restore the window configuration after editing a function