Race condition and updated gen_server2

Hey, this fixes a small bug when errors occur when calling exec. It is possible for a bad connection to get freed and then reused before its closed.