Make deleting Site Extensions more robust to locked directories and files

I tested by installing and uninstalling phpMyAdmin. Previously uninstallation would fail when the directory is locked.