Index: src/webapp/webservice/inc/GnuBoat/ServiceShutdown.php
===================================================================
--- src/webapp/webservice/inc/GnuBoat/ServiceShutdown.php	(revision 563c04b540657b88fb842951eca1a7bac9086756)
+++ src/webapp/webservice/inc/GnuBoat/ServiceShutdown.php	(revision d3bfa78b9e4486cf2004b0034f1a0cb60cb0f231)
@@ -36,22 +36,13 @@
 		if($handle === false){
 			$message = "Could not create file (". $config->shutdownRequestFile() .") to indicate shutdown to the daemon.";
-			error_log($message);
-			$result["shutdownstart"] = -1;
-			$result["errormessage"] = $message;
-		}
-		else{
-			$shutdownTime = new \DateTime('NOW');
-			$shutdownTime->modify("+15 seconds");
-			fwrite($handle, $shutdownTime->format(\DateTime::ATOM));
-			$result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM);
+			return $this->error($message, ["shutdownstart" => -1]);
 		}
 
-		header('Content-Type: application/json');
-		if($debug > 0){
-			echo json_encode($result,  JSON_PRETTY_PRINT) ."\n";
-		}
-		else{
-			echo json_encode($result) ."\n";
-		}
+		$shutdownTime = new \DateTime('NOW');
+		$shutdownTime->modify("+15 seconds");
+		fwrite($handle, $shutdownTime->format(\DateTime::ATOM));
+		fclose($handle);
+		$result["shutdownstart"] = $shutdownTime->format(\DateTime::ATOM);
+		$this->output($result);
 	}
 }
