diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
index 8af787b162c524aabcba383426b2ddf841d85088..c1bf4aa0c5433774f2891c7539ddefca47676763 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2015-2016 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2015-2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -660,7 +660,7 @@ void writeMesh
     Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
 
     processorMeshes::removeFiles(mesh);
-    if (!debugLevel)
+    if (!debugLevel && !(writeLevel&meshRefinement::WRITELAYERSETS))
     {
         topoSet::removeFiles(mesh);
     }