Fix create_resources so that ssh connections are not terminated unexpectedly