Add close function,
Bug: When Closing one windows sometimes all windows are closed