fixed #2280 fixed a bug that needn't call deleteBuffer in onExit

fixed a bug that needn't call deleteBuffer in onExit