Remove unused variable
Fix possible double close