Fix Close Function