   (-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 -----------------------------------------------------------------

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


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

    :soundeffect          (write-packet-soundeffect conn payload)
    :newinvalidstate      (write-packet-newinvalidstate conn payload)
    :openwindow           (write-packet-openwindow conn payload)
    :closewindow          (write-packet-closewindow conn payload)

    )
  (flushc conn))
