fixed sorting and performance, added tracking of files closed without saving