trying to fix end function in windows