Made the DirectoryStream used in directoryIsEmpty a try-resource, so it is automatically released no matter what happens.