make it close properly