improving/filling out the tcp interface, proper closing

[description to be added soon]