Fixed most warnings and fixed closing GUI.