Changed default close window behaviour to dispose window

Dispose is required to continue application and terminate itself
automatically.