Close window on save and cancel click.

Also added functionality to detect if changes were made to the configuration.