   (-write-byte conn windowid)
   (-write-byte conn inventorytype)
   (-write-string8 conn windowtitle)
-  (-write-byte conn numberofslots)
-)
+  (-write-byte conn numberofslots))
+
+(defn write-packet-closewindow [conn {windowid :windowid}]
+  (-write-byte conn (:closewindow packet-ids))
+
+  (-write-byte conn windowid))
 
 
 ; Writing Wrappers -----------------------------------------------------------------

        :newinvalidstate           (read-packet-newinvalidstate conn)
        :thunderbolt               (read-packet-thunderbolt conn)
        :openwindow                (read-packet-openwindow conn)

        :else (str "UNKNOWN PACKET TYPE: " packet-id)
        ))

    :inventorytype (-read-byte conn)
    :windowtitle (-read-string8 conn)
    :numberofslots (-read-byte conn)))

(defn read-packet-closewindow [conn]
  (assoc {}
    :windowid (-read-byte conn)))


; Reading Wrappers -----------------------------------------------------------------
