QDeclarativeTypeLoader doesn't close processed QNetworkReplies

backport of Qt5 patch https://codereview.qt-project.org/#change,76825

This bug causes that Cascades QML application cannot open more than
system ulimit defined number of different asset:///*.qml files.

The realFile is ordinary closed in the ~QNetworkReplyFileImpl(),
the QDeclarativeTypeLoader::networkReplyFinished() calls
reply->deleteLater(). There are tricky situations when event-loop is
not entered and too many read already files are waiting for close.

This patch close() file when all the data is read. It can be done
this way since the QNetworkReplyFileImplnetworkreply is a sequential
device.

For more info, please, read comments on QTBUG-36032

cherry-pick from: qtbase cc88e6e92c806def34bce8cdcab275934ab646bf

Task-number: QTBUG-36032
Change-Id: I896cf9a89c541d743db1ccc11ab853219d844884
Reviewed-by: Richard J. Moore <rich@kde.org>