Fixed error on close