Added event for window closing.
Fixed bug where Listbox would keep references to the original Array given as argument and modify it.