+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
 import os
-import six
 import subprocess
 from tempfile import NamedTemporaryFile
 from librarian import functions, get_resource, OutputFile
                                '--mobi-file-type=both',
                                '--mobi-ignore-margins',
                                ], **gen_kwargs)
+        devnull.close()
         return OutputFile.from_filename(output_file.name)