Fixed closing bug.