To close correctly.

![20140420195035](https://cloud.githubusercontent.com/assets/7346661/2750702/bbc6084e-c897-11e3-832d-9e0c51c92fba.jpg)
In exceptional circumstances,there will be a wrong output.