todo bugfix window closing