IOError - closed stream in erl_call provider