Fix some closing problems