Improve close handling for comments