clean up window handling