Changed how it detects windows for removing read-only flags