Is there a known bug in PHP that prevents the deletion of the last folder in a directory on Windows systems?

There is a known bug in PHP on Windows systems that prevents the deletion of the last folder in a directory due to a file handle being kept open. To solve this issue, you can use the `rmdir()` function in combination with `closedir()` to close the directory handle before attempting to delete the folder.

$directory = 'path/to/directory';

$handle = opendir($directory);

// Close the directory handle
closedir($handle);

// Delete the directory
rmdir($directory);