Fixed pending open files bug