fixes #4292 Add-File-window-breaking-on-Host

Fixed the issue and pushed the code for review, please check it.