window.onhashchange = function() {
    if ( window.location.hash === '#_closeTab' ) {
        chrome.runtime.sendMessage({
            'action': 'chrome.tabs.remove',
        });
    }
};

@@ -1,34 +1,22 @@
-window.onhashchange = function
+function checkHash
 () %7B
@@ -167,10 +167,70 @@
 %0A    %7D%0A%7D
+%0A%0Awindow.onhashchange = checkHash;%0Awindow.onload = checkHash
 ;%0A

Check hash on window.onload