Added proper handling of missing yarpserver and robust plugin closing