Issue #2339783 by Dave Reid: Fixed Possible errors while files deleted.