diff --git a/src/sink.cc b/src/sink.cc
index 319bfb829ee8bf0a11b3b8adab08b78a6cbd066b..ecbbb9fb930f8de878961f0f52219727ee1a364c 100644
--- a/src/sink.cc
+++ b/src/sink.cc
@@ -5,6 +5,14 @@
 
 #include "sink.h"
 
+#include <tbb/concurrent_queue.h>
+
+#include <cassert>
+#include <fstream>
+
+#include "OutputFile.h"
+#include "log.h"
+
 template class Sink<FileOutput>;
 
 template <typename TOutput>
@@ -31,7 +39,8 @@ void Sink<TOutput>::CommitOutput(const TOutput &f) {
     auto file = reinterpret_cast<const FileOutput &>(f);
     auto filename = file.GetFilename();
     LOG(TRACE) << "Closing file '" << filename << "'";
-    assert(file.Close());
+    auto is_closed = file.Close();
+    assert(is_closed);
     auto from = file.GetWorkingPath() + "/" + filename;
     auto to = GetRootPath() + file.GetDestinationDir() + "/" + filename;
     if (rename(from.c_str(), to.c_str()) != 0) {