diff --git a/scipost/templates/scipost/header.html b/scipost/templates/scipost/header.html
index ee721cb5d3a89069447de959446e7a7017c45f71..75d81553444001be75f360ebfe9baf5964eb0f04 100644
--- a/scipost/templates/scipost/header.html
+++ b/scipost/templates/scipost/header.html
@@ -47,11 +47,12 @@
 
          document.getElementById("header-search-close-btn").addEventListener("click", function(event){
              var x = document.getElementById("header-search-form");
-             x.style.display = "none"
+             x.style.display = "none";
          });
 
          if (document.documentElement.clientWidth <= 768) {
              // Force-close if form is prefilled.
+             var x = document.getElementById("header-search-form");
              x.style.display = "none";
          }
      }