Add close function to properly clean up used resources (heap & goroutine)