Cleaned up window code

This code is now self-destructing at the appropriate time.