[#2497] Remove folders with read only files on Windows.

Problem
=======

Delete folder fail on Windows if folder contain read only files

Changes
=======

Update code to remove read-only attribute and try again.

How to test
========

reviewers: @alibotean 

the main idea of this code was tested in compat.

this is just a sync since brink does not uses compat.

thannks!
onerror -> on_error