protecting against file closes