diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 998a333..1c10a49 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -166,6 +166,7 @@ QFSFileEngine::QFSFileEngine(QFSFileEnginePrivate &dd)
 QFSFileEngine::~QFSFileEngine()
 {
     Q_D(QFSFileEngine);
+    qDebug() << __FUNCTION__ << d->closeFileHandle;
     if (d->closeFileHandle) {
         if (d->fh) {
             int ret;
@@ -179,9 +180,12 @@ QFSFileEngine::~QFSFileEngine()
             } while (ret == -1 && errno == EINTR);
         }
     }
+    qDebug() << __FUNCTION__ << d->fileEntry.nativeFilePath();
     QList<uchar*> keys = d->maps.keys();
-    for (int i = 0; i < keys.count(); ++i)
-        unmap(keys.at(i));
+    for (int i = 0; i < keys.count(); ++i) {
+        bool r = unmap(keys.at(i));
+        qDebug() <<r << keys.at(i);
+    }
 }
 
 /*!
@@ -354,6 +358,7 @@ bool QFSFileEnginePrivate::openFd(QIODevice::OpenMode openMode, int fd)
 bool QFSFileEngine::close()
 {
     Q_D(QFSFileEngine);
+    qDebug() << __FUNCTION__ << d->fileEntry.nativeFilePath();
     d->openMode = QIODevice::NotOpen;
     return d->nativeClose();
 }
@@ -364,6 +369,7 @@ bool QFSFileEngine::close()
 bool QFSFileEnginePrivate::closeFdFh()
 {
     Q_Q(QFSFileEngine);
+    qDebug() << __FUNCTION__;
     if (fd == -1 && !fh)
         return false;
 
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 064a1a5..9d41f6e 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -255,6 +255,7 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
 */
 bool QFSFileEnginePrivate::nativeClose()
 {
+    qDebug() << __FUNCTION__;
     return closeFdFh();
 }
 
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index fb4107b..8f1273a 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -164,6 +164,7 @@ bool QFSFileEnginePrivate::nativeOpen(QIODevice::OpenMode openMode)
 */
 bool QFSFileEnginePrivate::nativeClose()
 {
+    qDebug() << __FUNCTION__ << fileEntry.fileName() << fh << fd;
     Q_Q(QFSFileEngine);
     if (fh || fd != -1) {
         // stdlib / stdio mode.
@@ -1067,6 +1068,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size,
 bool QFSFileEnginePrivate::unmap(uchar *ptr)
 {
 #ifndef Q_OS_WINPHONE
+    qDebug() << __FUNCTION__ << fileEntry.nativeFilePath() << ptr;
     Q_Q(QFSFileEngine);
     if (!maps.contains(ptr)) {
         q->setError(QFile::PermissionsError, qt_error_string(ERROR_ACCESS_DENIED));
@@ -1074,13 +1076,16 @@ bool QFSFileEnginePrivate::unmap(uchar *ptr)
     }
     uchar *start = ptr - maps[ptr];
     if (!UnmapViewOfFile(start)) {
+        qErrnoWarning("UnmapViewOfFile");
         q->setError(QFile::PermissionsError, qt_error_string());
         return false;
     }
 
     maps.remove(ptr);
     if (maps.isEmpty()) {
-        ::CloseHandle(mapHandle);
+        qErrnoWarning("Closing map handle");
+        if (!CloseHandle(mapHandle))
+            qErrnoWarning("CloseHandle");
         mapHandle = NULL;
     }
 
diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp
index 2b901c7..68bd59e 100644
--- a/src/corelib/io/qsavefile.cpp
+++ b/src/corelib/io/qsavefile.cpp
@@ -52,7 +52,7 @@
 #include "private/qiodevice_p.h"
 #include "private/qtemporaryfile_p.h"
 #ifdef Q_OS_UNIX
-#include <errno.h>
+#include <errfno.h>
 #endif
 
 QT_BEGIN_NAMESPACE
@@ -209,7 +209,6 @@ bool QSaveFile::open(OpenMode mode)
     // Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
     if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
         QFileDevice::FileError err = d->fileEngine->error();
-#ifdef Q_OS_UNIX
         if (d->directWriteFallback && err == QFileDevice::OpenError && errno == EACCES) {
             delete d->fileEngine;
             d->fileEngine = QAbstractFileEngine::create(d->fileName);
@@ -220,7 +219,6 @@ bool QSaveFile::open(OpenMode mode)
             }
             err = d->fileEngine->error();
         }
-#endif
         if (err == QFileDevice::UnspecifiedError)
             err = QFileDevice::OpenError;
         d->setError(err, d->fileEngine->errorString());
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 3cade0e..03e2258 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -42,7 +42,7 @@
 #include "qtemporaryfile.h"
 
 #ifndef QT_NO_TEMPORARYFILE
-
+#include <qdebug.h>
 #include "qplatformdefs.h"
 #include "private/qtemporaryfile_p.h"
 #include "private/qfile_p.h"
@@ -235,7 +235,8 @@ static bool createFileFromTemplate(NativeFileHandle &file,
 //************* QTemporaryFileEngine
 QTemporaryFileEngine::~QTemporaryFileEngine()
 {
-    QFSFileEngine::close();
+    qDebug() << __FUNCTION__ << "closing";
+     QFSFileEngine::close();
 }
 
 bool QTemporaryFileEngine::isReallyOpen()
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index ba4e691..d58fb2b 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -330,6 +330,7 @@ void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)
 
 void QWidgetResizeHandler::setMouseCursor(MousePosition m)
 {
+    qDebug() << __FUNCTION__ << widget << m;
 #ifdef QT_NO_CURSOR
     Q_UNUSED(m);
 #else
