added logging, deregistered callbacks before window terminates