Made the window user pointer functions a bit more pythonic (you can store normal python objects now) and added cleanup code to terminate().