Wraps close_window in try/catch