diff --git a/.gitignore b/.gitignore
index bde2fe708b8a37221417860efdcf591fbb1b072d..28853c5930f01543b5f669a47501b74ed00bcf3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -162,4 +162,8 @@ Desktop.ini
 # Mac OS X Finder
 .DS_Store
 
+# Ctags index files
+.tags
+.tags_sorted_by_file
+
 Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h
index 8c885b020b8fa755a07f1f4a7651f502a4d75825..4c05a061a66286481165a0f99c68e32984ceefa3 100644
--- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h
+++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/SaveNexusProcessed.h
@@ -65,6 +65,11 @@ namespace Mantid
       /// Algorithm's category for identification overriding a virtual method
       virtual const std::string category() const { return "DataHandling\\Nexus";}
 
+    protected:
+
+    /// Override process groups
+    virtual bool processGroups();
+
     private:
       
       /// Overwrites Algorithm method.
@@ -80,6 +85,8 @@ namespace Mantid
       void execEvent(Mantid::NeXus::NexusFileIO * nexusFile,const bool uniformSpectra,const std::vector<int> spec);
       /// sets non workspace properties for the algorithm
       void setOtherProperties(IAlgorithm* alg,const std::string & propertyName,const std::string &propertyValue,int perioidNum);
+      /// execute the algorithm.
+      void doExec(Mantid::API::Workspace_sptr workspace, Mantid::NeXus::NexusFileIO_sptr& nexusFile);
       
       /// The name and path of the input file
       std::string m_filename;
diff --git a/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp
index 35140e4a37b3092936a8a19810888602b97146a8..092c86d09a4abfa9d120d6b0051ff1d244a73128 100644
--- a/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp
+++ b/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp
@@ -152,18 +152,12 @@ namespace DataHandling
   }
 
 
-
-  //-----------------------------------------------------------------------------------------------
-  /** Executes the algorithm.
-   *
-   *  @throw runtime_error Thrown if algorithm cannot execute
-   */
-  void SaveNexusProcessed::exec()
+  void SaveNexusProcessed::doExec(Workspace_sptr inputWorkspace, Mantid::NeXus::NexusFileIO_sptr& nexusFile)
   {
     //TODO: Remove?
     NXMEnableErrorReporting();
 
-    Workspace_sptr inputWorkspace = getProperty("InputWorkspace");
+    
 
     // Retrieve the filename from the properties
     m_filename = getPropertyValue("Filename");
@@ -226,9 +220,8 @@ namespace DataHandling
       if( file.exists() )
         file.remove();
     }
-	// Then immediately open the file
-    Mantid::NeXus::NexusFileIO *nexusFile= new Mantid::NeXus::NexusFileIO( &prog_init );
 
+    nexusFile->resetProgress(&prog_init);
     nexusFile->openNexusWrite( m_filename );
 
     // Equivalent C++ API handle
@@ -258,7 +251,7 @@ namespace DataHandling
       // Write out the data (2D or event)
       if (m_eventWorkspace && PreserveEvents)
       {
-        this->execEvent(nexusFile,uniformSpectra,spec);
+        this->execEvent(nexusFile.get(),uniformSpectra,spec);
       }
       else if (offsetsWorkspace)
       {
@@ -293,8 +286,8 @@ namespace DataHandling
     // peaks workspace specifics
     if (peaksWorkspace)
     {
-      //	g_log.information("Peaks Workspace saving to Nexus would be done");
-      //	int pNum = peaksWorkspace->getNumberPeaks();
+      //  g_log.information("Peaks Workspace saving to Nexus would be done");
+      //  int pNum = peaksWorkspace->getNumberPeaks();
       peaksWorkspace->saveNexus( cppFile );
 
 
@@ -322,13 +315,28 @@ namespace DataHandling
     
     inputWorkspace->history().saveNexus(cppFile);
 
-    nexusFile->closeNexusFile();
-    delete nexusFile;
-
     return;
   }
 
 
+
+  //-----------------------------------------------------------------------------------------------
+  /** Executes the algorithm for a single workspace.
+   *
+   *  @throw runtime_error Thrown if algorithm cannot execute
+   */
+  void SaveNexusProcessed::exec()
+  {
+    Workspace_sptr inputWorkspace = getProperty("InputWorkspace");
+
+    // Then immediately open the file
+    auto nexusFile = boost::make_shared<Mantid::NeXus::NexusFileIO>();
+
+    // Perform the execution.
+    doExec(inputWorkspace, nexusFile);
+  }
+
+
   //-------------------------------------------------------------------------------------
   /** Append out each field of a vector of events to separate array.
    *
@@ -488,5 +496,26 @@ namespace DataHandling
       Algorithm::setOtherProperties(alg,propertyName,propertyValue,perioidNum);
   }
 
+  /**
+  Overriden process groups.
+  */
+  bool SaveNexusProcessed::processGroups()
+  {
+    return Algorithm::processGroups();
+    /*
+     // Go through each entry in the input group(s)
+    for (size_t entry=0; entry<m_groupSize; entry++)
+    {
+    
+    }  
+    // We finished successfully.
+    setExecuted(true);
+    notificationCenter().postNotification(new FinishedNotification(this,isExecuted()));
+
+    return true;
+    */
+
+  }
+
 } // namespace DataHandling
 } // namespace Mantid
diff --git a/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h b/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h
index 1b4de0b238bfae1790d36ab3fee34dcea7ee6c52..f2f2e99792bbc4f412b37b22aadf9135fbd58eb5 100644
--- a/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h
+++ b/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h
@@ -13,6 +13,7 @@
 
 #include <limits.h>
 #include <nexus/NeXusFile.hpp>
+#include <boost/shared_ptr.hpp>
 
 namespace Mantid
 {
@@ -59,7 +60,7 @@ namespace Mantid
       NexusFileIO( API::Progress* prog );
 
       /// Destructor
-      ~NexusFileIO() {}
+      ~NexusFileIO();
 
       /// open the nexus file for writing
       void openNexusWrite(const std::string& fileName);
@@ -101,12 +102,15 @@ namespace Mantid
       /// write bin masking information
       bool writeNexusBinMasking(API::MatrixWorkspace_const_sptr ws) const;
 
+       /// Reset the pointer to the progress object.
+      void resetProgress(Mantid::API::Progress* prog);
+
       /// Nexus file handle
       NXhandle fileID;
 
     private:
       /// C++ API file handle
-      ::NeXus::File *m_filehandle;
+      boost::shared_ptr< ::NeXus::File> m_filehandle;
       /// Nexus compression method
       int m_nexuscompression;
       /// Allow an externally supplied progress object to be used
@@ -432,6 +436,9 @@ namespace Mantid
       NXclosedata(fileID);
     }
 
+    /// Helper typedef for a shared pointer of a NexusFileIO.
+    typedef boost::shared_ptr<NexusFileIO> NexusFileIO_sptr;
+
   } // namespace NeXus
 } // namespace Mantid
 
diff --git a/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp b/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp
index 243856606020d9eafe2257b3127aded2bce23d15..1ddb28fb44010350704255ef5cb0302f7a1f4a71 100644
--- a/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp
+++ b/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp
@@ -30,7 +30,7 @@
 #include "MantidAPI/AlgorithmHistory.h"
 
 #include <boost/tokenizer.hpp>
-#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
 #include <Poco/File.h>
 
 namespace Mantid
@@ -49,7 +49,6 @@ using namespace DataObjects;
 
   /// Empty default constructor
   NexusFileIO::NexusFileIO() :
-          m_filehandle(0),
           m_nexuscompression(NX_COMP_LZW),
           m_progress(0)
   {
@@ -57,12 +56,16 @@ using namespace DataObjects;
 
   /// Constructor that supplies a progress object
   NexusFileIO::NexusFileIO( Progress *prog ) :
-          m_filehandle(0),
           m_nexuscompression(NX_COMP_LZW),
           m_progress(prog)
   {
   }
 
+  void NexusFileIO::resetProgress( Progress *prog )
+  {
+    m_progress = prog;
+  }
+
 
   //
   // Write out the data in a worksvn space in Nexus "Processed" format.
@@ -94,7 +97,6 @@ using namespace DataObjects;
     // @throw Exception::FileError if cannot open Nexus file for writing
     //
     NXaccess mode(NXACC_CREATE5);
-    std::string className="NXentry";
     std::string mantidEntryName;
     m_filename=fileName;
     //
@@ -121,7 +123,11 @@ using namespace DataObjects;
       g_log.error("Unable to open file " + fileName);
       throw Exception::FileError("Unable to open File:" , fileName);
     }
-    m_filehandle = new ::NeXus::File(fileID, true);
+    /*Only create the file handle if needed.*/
+    if (!m_filehandle)
+    {
+      m_filehandle = boost::make_shared< ::NeXus::File>(fileID, true);
+    }
 
     //
     // for existing files, search for any current mantid_workspace_<n> entries and set the
@@ -136,18 +142,21 @@ using namespace DataObjects;
     }
     //
     // make and open the new mantid_workspace_<n> group
-    // file remains open until explict close
+    // file remains open until explicit close
     //
+    const std::string className="NXentry";
     m_filehandle->makeGroup(mantidEntryName,className);
     m_filehandle->openGroup(mantidEntryName,className);
   }
 
-
   //-----------------------------------------------------------------------------------------------
   void NexusFileIO::closeNexusFile()
   {
-    m_filehandle->closeGroup();
-    delete m_filehandle;
+    if(m_filehandle)
+    {
+      m_filehandle->closeGroup();
+      m_filehandle.reset();
+    }
   }
 
   //-----------------------------------------------------------------------------------------------
@@ -1182,6 +1191,15 @@ using namespace DataObjects;
     return(static_cast<int>(entryName.size()));
   }
 
+  /**
+  Destructor
+  */
+  NexusFileIO::~NexusFileIO()
+  {
+    // Close the nexus file if not already closed. 
+    this->closeNexusFile();
+  }
+
 
 } // namespace NeXus
 } // namespace Mantid