Removing invalid close() from ec2