Fixed the closing error