[1.7.x] Fixed #23986 -- clear_dir no longer fails if dir doesn't exist

If the target directory didn't exist when running `collectstatic
--clear` then an OSError exeception would be raised. After this
fix, if the directory doesn't exist then the clear_dir function
will return early. If by chance, the user has a file matching the
name of the target directory a NotADirectoryError will now be raised.