Fixed issue on close() function of exec