close and re-open html markdown preview when switching between views