diff --git a/src/plugins/jobacct/common/common_slurmstepd.c b/src/plugins/jobacct/common/common_slurmstepd.c
index fa57cbd998158b99ab1df67e6a2b3e0ee01e9a6d..e9745f21398ae4f9db5140287ec6fc4a498ff054 100644
--- a/src/plugins/jobacct/common/common_slurmstepd.c
+++ b/src/plugins/jobacct/common/common_slurmstepd.c
@@ -43,7 +43,6 @@ bool jobacct_shutdown = false;
 bool suspended = false;
 List task_list = NULL;
 pthread_mutex_t jobacct_lock = PTHREAD_MUTEX_INITIALIZER;
-DIR *slash_proc = NULL;
 uint32_t cont_id = (uint32_t)NO_VAL;
 bool pgid_plugin = false;
 
@@ -51,9 +50,6 @@ extern int common_endpoll()
 {
 	jobacct_shutdown = true;
 
-	if (slash_proc)
-		(void) closedir(slash_proc);
-       
 	return SLURM_SUCCESS;
 }
 
diff --git a/src/plugins/jobacct/common/jobacct_common.h b/src/plugins/jobacct/common/jobacct_common.h
index 61a88295894347ef85b7093f781f24baefc4218d..879134aa91ceb3bce82caa635148281156635d7d 100644
--- a/src/plugins/jobacct/common/jobacct_common.h
+++ b/src/plugins/jobacct/common/jobacct_common.h
@@ -133,7 +133,6 @@ extern bool jobacct_shutdown;
 extern bool suspended;
 extern List task_list;
 extern pthread_mutex_t jobacct_lock;
-extern DIR  *slash_proc;
 extern uint32_t cont_id;
 extern bool pgid_plugin;
 
diff --git a/src/plugins/jobacct/linux/jobacct_linux.c b/src/plugins/jobacct/linux/jobacct_linux.c
index 81ff9cfdcda64f2ac46cbb92fbfb70cc013b0f72..414280da2a4a3cbbebdb5dca542c28ec40c3402d 100644
--- a/src/plugins/jobacct/linux/jobacct_linux.c
+++ b/src/plugins/jobacct/linux/jobacct_linux.c
@@ -87,6 +87,8 @@ typedef struct prec {	/* process record */
 } prec_t;
 
 static int freq = 0;
+static DIR  *slash_proc = NULL;
+
 /* Finally, pre-define all local routines. */
 
 static void _get_offspring_data(List prec_list, prec_t *ancestor, pid_t pid);
@@ -265,6 +267,9 @@ int jobacct_p_endpoll()
 	task_list = NULL;
 	slurm_mutex_unlock(&jobacct_lock);
 	
+	if (slash_proc)
+		(void) closedir(slash_proc);
+
 	return common_endpoll();
 }
 
@@ -586,8 +591,8 @@ static int _get_process_data_line(FILE *in, prec_t *prec) {
  * IN, OUT:	Irrelevant; this is invoked by pthread_create()
  */
 
-static void *_watch_tasks(void *arg) {
-
+static void *_watch_tasks(void *arg)
+{
 	while(!jobacct_shutdown) {  /* Do this until shutdown is requested */
 		if(!suspended) {
 			_get_process_data();	/* Update the data */