diff --git a/src/OutputFileHandler.h b/src/OutputFileHandler.h
index 6bddcfdd8bf2f1964aa9a71a0957d819ef6efe70..08a55cf438ce3ed49a56e8cece9316cb10ef0d3d 100644
--- a/src/OutputFileHandler.h
+++ b/src/OutputFileHandler.h
@@ -11,7 +11,7 @@
 
 class OutputFileHandler {
  public:
-  OutputFileHandler(const std::string base_path, const std::string filename_prefix)
+  OutputFileHandler(const std::string &base_path, const std::string &filename_prefix)
       : base_path_(base_path),
         filename_prefix_(filename_prefix),
         working_files_base_path_(base_path_ + "/" + working_dir_),
@@ -19,8 +19,9 @@ class OutputFileHandler {
         current_index_(0),
         current_filename_(""),
         current_file_(0),
-        close_and_rename_(base_path),
-        t(std::thread(close_and_rename_)) {
+        close_and_rename_(base_path_),
+        t{} {
+    t = std::thread(close_and_rename_);
     create_output_directory_maybe(working_files_base_path_);
   }
 
@@ -33,6 +34,8 @@ class OutputFileHandler {
 
   FILE *getFile(uint32_t run, uint32_t index);
 
+  bool hasFile() { return current_file_ != 0; }
+
  private:
   void create_output_directory_maybe(std::string &output_directory);
 
@@ -47,7 +50,7 @@ class OutputFileHandler {
 
   class close_and_rename {
    public:
-    close_and_rename(std::string base_path) : base_path_(base_path) {}
+    close_and_rename(std::string &base_path) : base_path_(base_path) {}
 
     void operator()() const;