Fixed bug in re-opening files.