close properly