Added port closing upon exit