Make close_overlay function handle split windows.