Fixed an issue where the 'close' callback wasn't called in newer version of node