Add null pointer check to startClosing and sendMessage methods.