Update adapter.js

Fixed an issue in destroy method