The stock market closed on a positive note on Wednesday with both benchmark indices recording gains.