Added prevention of ending background ops when closing window