Fix try to delete file while it does not exist anymore (see #2102 and #1713) in reference to this issue (V4.0)

Remove warning if file does not exist already and check if file is null elsewhere.

see comments in #2102 and #1713