event management for opening/closing windows