Added close event to server. Samples working much more nicely now.