Fix docker api timeout errors. Properly clean up connections