BUGFIX do not reopen file if it is already open